Angular does not have a built-in way of storing the model life cycle state, that is, the state due to which it is an asynchronous and potentially obsolete copy of the remote model stored on the server or where the server will be obsolete compared to the client. Considering how Ember does this, http://emberjs.com/guides/models/model-lifecycle/ , they have several states for Model objects:
- LOADING
- LOADED / CLEANING
- DIRTY
- IN FLIGHT
- INVALID
- ERROR
Angular Models seem to be just plain old Javascript objects, and therefore do not have this. Looking at the $ resource, which seems to be closer to what I'm looking for, it seems to have nothing to do with the state. My goal is to make it clear to the user when something needs to be stored on the server, and the result of any such savings.
- What would be a good way to do this?
- Are there any existing libraries for this, or will I have to collapse my own?
Edit: I'm not saying that the DOM is outdated compared to the model in browser memory. I understand that Angular treats all this as a two-way data binding, as described in http://docs.angularjs.org/guide/dev_guide.templates.databinding . This handles states where the model itself may differ from the server.
source share