Model Layer for large angular >v1.2 applications with some niceties - based on $watch pattern inspired by Jason Dobry's Presentation.
Read me for examples and docs.
single source of truth inside a Resource service. Returns data which can be consumed by our view controllers and directives. With this approach all consumers get parallely informed when the model changes.
intelligent caching with atomic resource handling to avoid making unnecessary requests. Atomic resources are objects with an id and resource name like user (id 5), user (id 12), user (id 42) etc. Especially in mobile apps you want to avoid expensive and battery-consuming network traffic.
optimized requests. In collections and nested requests the service avoids asking for resources which are already given from past requests.
local data manipulations. Sometimes we already want to change the model to respond fast to the user input. This happens before we even informed the server. The server update is handled in the background.
view states to represent the status (isReady, isError, isEmpty) in the view.
sideloading to fill the resource cache with multiple data of different kind with only one request.
nested resource builder preparing the data and all its related resources to make it ready for further processing
frequent interval updates for keeping some data up-to-date by synchronizing with the server frequently.