I want to override the value
angular.module("data", []).value('apiBase', '/api1/data')
at runtime, I tried changing it using
angular.module("data").value('apiBase', '/someotherapi/data')
in some service / controller, but it did not pass, it did not override apiBase value.
I tried to enter apiBase in my controller and change it.
angular.module('data').controller(function(apiBase){apiBase = '/someotherapi/data'})
it failed.
Then I tried changing defin apiBase to an object like
angular.module("data", []).value('apiBase', {"api_base_url":"/api1/data"})
then changing it in the controller:
angular.module('data').controller(function(apiBase){apiBase.api_base_url = '/someotherapi/data'})
It works. so my question is: why angular.module('data').value('samekey', 'newvalue') cannot override the value? why it is impossible to change the value when it is just a string / number (primary type, second attempt). In my opinion, the Value provider is singleton, it needs to change.