Models
Use app.model() to declare shared reactive application state as an injectable service.
A service is one reusable object or function that AngularTS can provide to controllers, components, directives, and other services. The act of requesting that service by name is called dependency injection.
Start with shared models, then choose
the guide for the feature you need. Use the service
reference when you already know a service token
such as $http.
Use app.model() to declare shared reactive application state as an injectable service.
Send requests with the $http service and configure defaults, transforms, interceptors, and XSRF behavior.
Use $eventBus for application-wide publish/subscribe messaging and scope events for scope-tree communication.
Stream server events with $sse, exchange bidirectional messages with $websocket or $webTransport, and offload work with ng-worker and ng-wasm.
Define typed REST endpoints once and use $rest for list, get, create, update, and delete flows backed by pluggable backends.
Navigate between named states, read and modify the URL, manage history, and intercept route transitions.
Read and write cookies with $cookie, serialize objects, and use $window.localStorage or sessionStorage for client-side persistence.
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.