javascript - AngularJS how to change ng-model binding to another element -


how dynamically rebind elements ng-model (change ng-model subject)

for example have

<input type="text" ng-model="info"> <input type="text"> 

but after user interactions want modify

<input type="text" ng-model="info"> <input type="text" ng-model="info"> 

or other variables. ideas how dynamically?

then make array.

in controller

$scope.info = []; 

in html dynamically

<input type="text" ng-model="info[$index]"> 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -