Tutorial by Examples

Constant is available both in configuration and run phases. angular.module('app',[]) .constant('endpoint', 'http://some.rest.endpoint') // define .config(function(endpoint) { // do something with endpoint // available in both config- and run phases }) .controller('MainCtrl', ...
Value is available both in configuration and run phases. angular.module('app',[]) .value('endpoint', 'http://some.rest.endpoint') // define .run(function(endpoint) { // do something with endpoint // only available in run phase }) .controller('MainCtrl', function(endpoint) { ...
Factory is available in run phase. The Factory recipe constructs a new service using a function with zero or more arguments (these are dependencies on other services). The return value of this function is the service instance created by this recipe. Factory can create a service of any type, w...
Service is available in run phase. The Service recipe produces a service just like the Value or Factory recipes, but it does so by invoking a constructor with the new operator. The constructor can take zero or more arguments, which represent dependencies needed by the instance of this type. ...
Provider is available both in configuration and run phases. The Provider recipe is syntactically defined as a custom type that implements a $get method. You should use the Provider recipe only when you want to expose an API for application-wide configuration that must be made before the appli...

Page 1 of 1