angularjs - ng-click not working on dynamic added DIV by jquery -


following code added after page renders on dom jquery.

owldata = '<div class="item"><div class="ifl-removepic" ng-click="deletedocument("'+e.target.result+'");"></div><img src="' + e.target.result + '"></div>'; 

in deletedocument(string) function not getting called defined in respective controller. because of html code written in .js file?

you need $compile 1st make ng-click work.

var owldata = angular.element(             '<div class="item"><div class="ifl-removepic" ng-click="deletedocument("'+e.target.result+'");"></div><img src="' + e.target.result + '"></div>'             );  owldata = $compile(owldata)($scope); angular.element(some_root).append(owldata); 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -