enter image description hereI am trying to append HTML elements dynamically which have AngularJS ng-click
, but it’s not working. I have tried {{2+2}}
in iEl.append(<div>{{2+2}}<div>)
,
but it’s not working.
What am I doing wrong?
$scope.appendContent = function() {
var iEl = angular.element( document.querySelector( '#med2' ) );
iEl.append('<div class="row well" ng-controller=Directive id="med1"> <div class="col-sm-12" > <p>Medication {{2+2}}</p> <div class="col-sm-4"> Medicine <div class="well" dragular="{"classes":{"mirror":"custom-green-mirror"},"nameSpace":"same"}"></div> </div> <div class="col-sm-3"> Frequency <div class="well" dragular="{"classes":{"mirror":"custom-green-mirror"},"nameSpace":"same"}"></div> </div> <div class="col-sm-4"> Days <div class="well" dragular="{"classes":{"mirror":"custom-green-mirror"},"nameSpace":"same"}" ng-click=appendContent()></div> </div> <div class="col-sm-1"> <button class="close cursorDefault" ng-click="removeDIV()">X</button> </div> </div>');
};
I want html view like this, auto append when ever fill the value.