Found my problem!  The file was using its own callback called States.  I 
just had to create the callbacks and all was well.   Below is the code :)


angular.module('locationApp')
  .controller('MainCtrl', ['$scope', '$http', function ($scope, $http) {


    $scope.states = [];
    $scope.cities = [];


    // Function for the States callback on the JSON files provided
    window.states = function (data)
    {
      $scope.states = data;
    };


    // function for the cities callback on the JSON files proviced
    window.cities = function (data)
    {
      $scope.cities = data;
    };


     // Get the State JSON file.   
    $http.jsonp('http://locationinc-mapping-demo.herokuapp.com/states.json'
);


}]) // end of MainCtrl

On Sunday, April 5, 2015 at 12:29:13 PM UTC-4, Ryan DesRoches wrote:
>
> Yeah - I have.    When I use JSONP and ask to read in the 
> http://massachusettswebdesigns.com/states-jsonp.json file,  I get *states 
> is not defined *error.
>
> Here's the factory code with the JSONP use:
>
>
> angular.module('locationApp').
> factory("ReadJson", ['$http', function ReadJsonFactory($http)
> {
>  return {
>  // GetJson -  Gets a JSON based URL and returns it as an object.
>  getJson:function(url)
>  {
>     return $http.jsonp(url).then(function (result) 
>     {
>      console.log("Result = " + result.data);
>             return result.data;
>         });
>  
>  } 
>  }
> }]);
>
>
> Again, stumped on this one. . . 
>
> Ryan
>
> On Sunday, April 5, 2015 at 2:55:58 AM UTC-4, Sander Elias wrote:
>>
>> quick question, did you try $http.jsonp 
>> <https://docs.angularjs.org/api/ng/service/$http>?
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to