Answer the question
In order to leave comments, you need to log in
Why is the element wrapping incorrectly?
zamena.replaceWith('<input type="text" ng-model="name" id="inputNewName" autofocus>');
$('#inputNewName').after('<p id="trash" class="ng-binding">{{name}}</p>');
Answer the question
In order to leave comments, you need to log in
Most likely that the inserted pieces of code are not compiled.
You need to use $compile in order for angular to know about the new elements.
Something like that:
var elem1 = zamena.replaceWith('<input type="text" ng-model="name" id="inputNewName" autofocus>');
var elem2 = $('#inputNewName').after('<p id="trash" class="ng-binding">{{name}}</p>');
$compile(elem1)($scope);
$compile(elem2)($scope);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question