I was wondering, say I have the following DOM structure in my View / Webpage
<div>
<p>I am some text or a comment or something</p>
<a href="" ng-click="deleteThisDiv()">X</a>
</div>
<div>
<p>I am some text but this Div may have more content like IMG or inputs</p>
<a href="" ng-click="deleteThisDiv()">X</a>
</div>
I'd like to add a method on the controller called deleteThisDiv that will remove the parent DIV of the href and all the DIV's contents (including the href I just clicked). This is easy with jQuery as I could just get the parent and use $target.remove() however I want to get out of the jQuery way of things and remove the item using AngularJS best practice. I know I could use jqLite as $target.remove() is supported and I guess I could climb the DOM tree to find the DIV but is there a better* way to do this (like using ng-show/ng-hide, etc)? Please note that I can add IDs to my HTML but I don't want to populate the HTML structure with IDs just yet.
- When I say better I mean an AngularJS way! I just want to get out of the mind set of using jQuery for these things... please note that the HTML is coded and not produced by an array or looping through objects, etc