Reputation: 101
I have the AngularJS module declaration as below. Here I have declared value AppModel.
I wanted to write code which will be triggered when AppModel.currentTable
is changed, How can I watch for this value change ?
angular.module('MIIApp', ['MIIServices']).
value("AppModel",{
currentTable:"TESTME-h",
currentUser:null
});
Any help!!!.
Upvotes: 1
Views: 1173
Reputation: 32785
I don’t think you should be doing this. As you can see here a value is intended to be a constant:
value(name, value)
A short hand for configuring services if the $get method is a constant.
In AngularJS a service is a singleton and a value is the most simple of the possible services, when called returns always the same. I don’t know what you need, but could it be you are confusing models with services?
Upvotes: 1