javascript - angularJS emptying input field on filter -


today faced situation angularjs.

hi have recipe website, , list ingredients , theyr respective dosage i'm using angular's ng-repeat (here goes snippet).

<div ng-repeat="food in foodlist | filter:query">     <label>         {{food.name}}     </label>     <input type="text" class="form-control food-list-input" data-id="{{food.ingredientid}}" placeholder="weight in grams."> </div> 

the thing when apply filter, inputs inserted value, if hidden because of filter, return empty.

is there anyway around this?

i think want bind input using ng-model, example:

<input type="text" ng-model="food.dosage" class="form-control food-list-input" data-id="{{food.ingredientid}}" placeholder="weight in grams."> 

that implement two-way binding model input tag, when ng-repeat re-runs, entered values re-bound model.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -