angularjs - remove HTML element on click in Angular js -
this directive. display 1 div on body.
app.directive("autosuggest", function($rootscope) { return { scope: { doneflag : "=", groupflag : "=", inviteesflag : "=", init: '&' }, templateurl : "title.html", link: function(scope, element, attrs) { } });
and in title.html
<div class="showw"> <img id="hidedivonclick" src="ddd.png"/> </div>
and include directive this
<div autosuggest="" done-flag="1" group-flag="1" invitees-flag="1" selected-array="" ></div>
so when click on image <div autosuggest="" done-flag="1" group-flag="1" invitees-flag="1" selected-array="" ></div>
parts gets remove body. remove element in javascript. how achive in angularjs?
you can create directive, adds function remove html of element. can stick on ng-click. made fiddle here: http://jsfiddle.net/qdht9/
// in directive scope.remove = function() { elt.html(''); }; // in dom <div remove-on-click ng-click="remove()"> remove me </div>
hope helped!
Comments
Post a Comment