I can't seem to search the right terms. I've read through a bunch of stuff and cannot find what I want to do. I'm sure there is an angular way
of doing this that I haven't read through in the docs.
I want to create a global value or service...something like
main.value 'settings', (->
data =
testing: 'teset'
setTimeout ->
data.testing = 'what'
console.log('from settings', data)
, 5000
return data
)()
In a real example, the values will be updated with pubsubs instead of a timeout.
I also tried doing this with a factory and a service, but same deal.
My controller might look something 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 want to be able to use a dynamically changing global model to update views with controllers.
What is the correct approach with Angular?