I thus inhibit the input of users with ng-model in the view
& Lt; Input ng-model = "car" & gt;
And in my controller I have $ scope.car to get the value and store it elsewhere. In my case, I store it in local storage, but local storage How is the saved value received and set to $ scope.car?
I tried
var settingFrmStorage = $ localstorage.getObject ('vehicles'); $ Scope.car = settingFrmStorage [0] .type.car;
But in my input I do not see any value; I can see the value of console.log (settingFrmStorage [0] .type.car;)
What is this.
There are some problems that may be causing this.
- You are doing it outside the Digest cycle, so the angular framework does not detect changes and does not update the element.
- You walk in troubles because you use a flat reference See for details
Then, to reduce it: Store an object to an object Use as
$ scope.carStore.car = 'some values';
In your markup:
& lt; Input ng-model = "carstore.car" & gt;
If that does not work, it means that you need to apply yourself to $.
No comments:
Post a Comment