I'm looking for a pattern in order to have globals constant in my application. But not with a controller or a factory. (so not with app.constant() too)
I just want to set a variable but I didn't find something good.
I wanted to set this var in my rootScoop but without success. with something like
myApp.run(function($rootScoop){
$rootScoop.global = {};
});
When I use that code, an arror occurs for nothing (transtateFilterProvider). When I delete this code, the translateService works,
I MUST have access in all html view, I don't want to always use a controller (useless in this case), I just want to set a global variable in rootScoop.
Thank you.
window) using pure JS (no angular):window.constants = {}window.constantsorwindow["constants"]. If that doesn't work you could expose that on the template's controller (scope).var app = angular.module("app", []); app.run(function($rootScope){ $rootScope.constants = { "client": { 'name' : 'client' } }; console.log($rootScope); });$scope.constants = window.constants- but be aware that you would need to do this in all controllers where you want to access your constants.