I have an input type number set to
<input type="number" ng-model="inputModel"/>
Where inputModel is $rootScope.inputModel. Every time I change the input box the value does not persist onto the $rootScope. Is it not possible to bind an input box to a $rootScope? what am I missing here?
I basically have another controller that performs calculations on given $rootScope and those calculations change depending on what the value of the input box is.
An help is much appreciated
Thanks
As others pointed out, it is a prototypical inheritance problem. Your input model is generated in the current scope, not the rootScope.
Always use "." in your views. This will work:
rootScope.fields = {
inputModel: ''
}
and
<input type="number" ng-model="fields.inputModel"/>