I have a html like this
<select data-ng-model="selection">
<option value="">Select Search</option>
<option value=1>One</option>
<option value=2>Two</option>
<option value=3>Three</option>
</select>
<input type="text" placeholder="search One" data-ng-model="search.one" data-ng-if="selection==1"/>
<input type="text" placeholder="search Two" data-ng-model="search.two" data-ng-if="selection==2"/>
<input type="text" placeholder="search Three" data-ng-model="search.three" data-ng-if="selection==3"/>
Selected: {{selection}}
Search by: {{search}}
In the above code, If an option is selected, the text box associated with that option is visible. But, if some input entered in the text box, the variable search
('search by' field in above code) is not getting updated. but if I delete data-ng-if
, then search
variable is getting updated properly.
What should I do to get search
variable updated with data-ng-if
?
Thank you!