I've been struggling to find the right search terms. Despite reading various resources, I can't seem to locate the specific solution I'm looking for. I'm certain there must be an innovative way to do this in Angular that I haven't come across in the documentation.
My goal is to establish a global value or service...something along these lines:
main.value 'settings', (->
data =
testing: 'teset'
setTimeout ->
data.testing = 'what'
console.log('from settings', data)
, 5000
return data
)()
In a practical scenario, the values will be updated using pubsubs instead of a timeout.
I also attempted creating a factory and a service for this purpose, but encountered similar issues.
A potential structure for my controller could be like this:
main.controller('somecontroller', ['$scope', 'settings',
($scope, settings)->
$scope.test = settings.testing
$scope.$watch settings.testing, ->
console.log 'here we ', settings
$scope.test = settings.testing
I aim to utilize a dynamically changing global model to automatically update views with controllers.
What would be the most effective approach to achieve this in Angular?