javascript - Change ng-bind and ng-model dynamically -


i need help. have project , need duplicate html nodes dynamically. nodes have ng-bind , ng-model attributes this:

<input class="quest_model" type="text" data-ng-model="quest"> <span ng-bind="quest" class="quest_bind"></span> 

i can change attributes whith jquery this:

quest.find("span.quest_bind").attr("ng-bind", "quest" + seq); 

but, when press button duplicate node, magic of angularjs(ng-bind) not happens. can me?

use json object

$scope.quest = { 'this': 'some random value', 'that': 'some other value' } $scope.seq = 'this' 

then have reference json object in controller

<span ng-bind="quest[seq]" class="quest_bind"></span> 

set ng-model of input $scope.seq allow control span element binded to.

<input class="quest_model" type="text" ng-model="seq"> 

so if type "that" in input box bind span tag $scope.quest.that, equals "some random value"

likewise, if type "this" in input box bind span tag $scope.quest.this, equals "some other value"


Comments