i'm trying to modify a global value from a controller and use it, modified , on another one but the variable holds the old value.
app.js
var app = angular.module('PressRoom', []);
app.value('globals',
{
companyName: 'My company',
appName: 'My app',
user: {
name: 'Test user',
img: '',
role: ''
}
});
Controller where i want to modify it
app.controller('LoginController', ['$scope','globals',function($scope,globals)
{
$scope.globals = globals;
globals.user.name = "Brand new user";
// Redirect to dashboard.
}]);
Controller where i want to use it modified.
app.controller('DashboardController', ['$scope','globals',function($scope,globals,)
{
$scope.globals = globals;
}]);
In the view of the last controller, i'm using the globals values on a directive, but it displays Test user instead of Brand new user