I'm facing some challenges in modifying the variables within my angular modules through the console.
One specific property in my code will eventually be coming from the backend server. However, I want to test my templates by changing this property manually for now.
To illustrate, consider the example from the angularjs documentation:
myApp.value('clientId', 'a12345654321x');
myApp.controller('DemoController', ['$scope', 'clientId', function DemoController($scope, clientId) {
$scope.clientId = clientId;
}]);
I am looking for a way to dynamically change this value during runtime using the console. Is there anyone familiar with how to achieve this?
I attempted using a different global object but the digest cycle is not detecting the changes.
var myNamespace = {clientId: "a12345654321x"};
myApp.controller('DemoController', ['$scope', function DemoController($scope) {
$scope.specialGlobal = myNamespace;
}]);
//Then in the html template
<h1>{{specialGlobal.clientId}}</h1>
While this approach works upon initial load, any alterations made to myNamespace.clientId
via the console do not reflect in the application.
Using angularjs version 1.3.x