Skip to content

Instantly share code, notes, and snippets.

@stevenh77
Created May 29, 2015 14:33
Show Gist options
  • Save stevenh77/9432d9e9f6599f770f56 to your computer and use it in GitHub Desktop.
Save stevenh77/9432d9e9f6599f770f56 to your computer and use it in GitHub Desktop.
//define module
var app = angular.module('app', []);
//define constant
app.constant("mynumberValue", 200);
//define value
app.value("numberValue", 100);
app.value("objectValue", { name: "dotnet-tricks.com", totalUsers: 120000 });
// only difference is that values cannot be used in module config function
app.config(function (mynumberValue) { //here value objects can't be injected
console.log("Before:" + mynumberValue);
mynumberValue = "New Angular Constant Service";
console.log("After:" + mynumberValue);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment