Buat dan gunakan konstanta di AngularJS

// Storing a single constant value
var app = angular.module('myApp', []);

app.constant('appName', 'My App');

// Now we inject our constant value into a test controller
app.controller('TestCtrl', ['appName', function TestCtrl(appName) {
    console.log(appName);
}]);

// Storing multiple constant values inside of an object
// Note: values in the object mean they can be modified
var app = angular.module('myApp', []);

app.constant('config', {
    appName: 'My App',
    appVersion: 1.0,
    apiUrl: 'http://www.facebook.com?api'
});

// Now we inject our constant value into a test controller
app.controller('TestCtrl', ['config', function TestCtrl(config) {
    console.log(config);
    console.log('App Name', config.appName);
    console.log('App Name', config.appVersion);
}]);
Successful Scarab