Service.js
this.showSpinner = function (Id) {
angular.element("<wave-spinner id='spinner00' ng-show='true'></wave-spinner>").remove();
var myEl = angular.element(document.querySelector("#header00"))
myEl.prepend($compile("<wave-spinner id='spinner00' ng-show='true'></wave-spinner>")($rootScope));
};
HTML
<div id="header00" style="">Some Content</div>
I tried using prepend
method as mentioned in jQlite, but its not working.
- How do I show directive before div
header00
? .append works with directive but not .prepend to add any html content before matched div element. - When directive is called again, how do I remove existing html.
remove()
is not working for me.