Hacker News new | past | comments | ask | show | jobs | submit login

Model files in angularJS are often basic wrappers around either $ressource or $http. From that you can add default values, collection-like functions, etc.



Do you happen to have a link to an example for those of us just getting started in Angular?


I 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




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: