Reputation: 4791
Can I have some JSON object that is employes.json file for example:
{"employees":[
{"firstName":"John", "lastName":"Doe"},
{"firstName":"Anna", "lastName":"Smith"},
{"firstName":"Peter", "lastName":"Jones"}
]}
And than use that object inside of a script where angular.js is? In other words how can I invoke predefined object in angular file and parse it?
Upvotes: 1
Views: 52
Reputation: 43156
Just load it using $http
service, for example
$http.get(url).then(function(response){
// here response.data will be parsed JS object
});
Upvotes: 5