Creating constant Services

The constant service is basically the same as the value service, except that constant services are available in the configuration phase of building the Module object, whereas value services are not. The constant method uses the following syntax, where name is the service name and object is any JavaScript object you want to provide:

constant(name, object)

For example:

var app = angular.module('myApp', []);
app.constant('myConst', "Constant String");

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.179.48