Reputation: 1
This is my HTML structure in Ionic project.
<div ng-model="pollPage.test.username">updated content</div>
{{pollPage.test.username}}
Controller:
vm.test = {
username : 'static',
}
When I use check my page, its getting 'static' text however it should be 'updated content'
Whats the problem? I guess everything is right but its not working. Thanks.
Upvotes: 0
Views: 523
Reputation: 2486
ng-model
should be on an element that its content changes like: input, select, textarea...etc
Upvotes: 0
Reputation: 1354
Your code is wrong it shoulbe like this:
<div ng-controller="yourController as vm">
<input type="text" ng-model="vm.pollPage.test.username">
<div>{{pollPage.test.username}}</div>
</div>
You cant asign ng-model to a div it must be on elements I/0 like inputs, dropdowns, checks, etc.
Controller:
var vm = this;
vm.pollPage = {};
vm.pollPate.test = {
username : 'static',
}
Upvotes: 1