I just started learning AngularJS. I want to implement a page for editing user info by showing the old info in the input field on the page. whenever the user want to update info they can see the old info displayed in the input box and they can change the value which will be stored in ng-model. I used before without ng-model and it works
<input type="text" value="{{event_detail.title}}" class="inputbox form-control">
However it doesn't work with data-ng-model
<input type="text" value="event_detail.title" required id="title" name="title" class="inputbox form-control" data-ng-model="eve.title" placeholder="Title">
is there anyway to solve this problem?
I just started learning AngularJS. I want to implement a page for editing user info by showing the old info in the input field on the page. whenever the user want to update info they can see the old info displayed in the input box and they can change the value which will be stored in ng-model. I used before without ng-model and it works
<input type="text" value="{{event_detail.title}}" class="inputbox form-control">
However it doesn't work with data-ng-model
<input type="text" value="event_detail.title" required id="title" name="title" class="inputbox form-control" data-ng-model="eve.title" placeholder="Title">
is there anyway to solve this problem?
Share Improve this question asked Aug 1, 2014 at 17:52 FizzzzFizzzz 371 gold badge1 silver badge4 bronze badges2 Answers
Reset to default 1you dont need value
<input type="text" ng-model="event_detail.title" class="inputbox form-control">
OR
<input type="text" ng-model="event_detail.title" required name="title"
class="inputbox form-control" placeholder="Title">
In the first example you use event_detail.title. In the bottom example it is eve.title. Please make sure that the variable you use actually exists. Also, if you use ng-value, you shouldn't use the tag's value attribute.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744984328a4604521.html
评论列表(0条)