5 ms·
Model files in angularJS are often basic wrappers around either $ressource or $http. From that you can add default values, collection-like functions, etc.
by olouv 13y ago
Model files in angularJS are often basic wrappers around either $ressource or $http. From that you can add default values, collection-like functions, etc.
- joshuacc 13y agoDo you happen to have a link to an example for those of us just getting started in Angular?
- psgibbs 13y agoI think typically people start them out in 'services.js' since effectively models in angular are constructors that are created, and then injected whenever you need a certain type (so you have a service that returns the constructor function). A good example of this is how the tutorial treats the restful 'Phone' resource, creating a service that injects the resource where necessary. I've started calling them 'models' rather than 'services' internally as well, so it's interesting to me that others are too. http://docs.angularjs.org/tutorial/step_11 http://docs.angularjs.org/tutorial/step_11