i everybody, I wanna do something like this, $('[property="something"]').remove(), but in angular, someone can help me.
1 Answer
Angular has element which has similar syntax as JQuery. By default it only supports jqLite which only has a subset of what is available with JQuery, but if you make sure to load JQuery before you load Angular then JQuery will be used in place of jqLite.
You can then do angular.element('[property="something"]').remove();
Do note that there will almost always be a better way of solving a problem, the only place you really should be doing DOM manipulation is inside directives.
2 Comments
Beto
thanks alot man, One more little question, I can use the Element that the link function provide me by the same way? I mean something like this:{ link : function ($scope, iElement, iAttrs, controller) { iElement.element('[property="something"]').remove(); }} I will be grateful if you can send me this information.
ivarni
You can use it directly,
iElement('[property="something"]').remove()