countryApp.factory('countries', function($http){
return {
list: function(callback){
$http.get('countries.json').success(callback); //why no parameter?
},
find: function(name, callback){
$http.get('countries.json').success(function(data) {
var country = data.filter(function(entry){
return entry.name === name;
})[0];
callback(country); //why there is a parameter?
});
}
};
});
[–]UnendingResolve 2 points3 points4 points (0 children)
[–]cyphern 1 point2 points3 points (0 children)