Skip to content Skip to sidebar Skip to footer

Angularjs: Prepend Html Using Directive

Service.js this.showSpinner = function (Id) { angular.element('').remove(); var myEl = angular.eleme

Solution 1:

You can do it this way:

<wave-spinner id='spinner00' ng-show='isLoadingContent'></wave-spinner> 
<div id="header00" style="">Some Content</div>

and in service.js

this.showSpinner = function () {
     this.isLoadingContent = true;
 };

Solution 2:

Your code only needs a simple change. Switch the before function which does not exist to prepend ( You said that you have tried it but I'm sure this is the solution to this problem ).

myEl.prepend($compile("<wave-spinnerid='spinner00'ng-show='true'></wave-spinner>")($rootScope));

To be sure I checked in jsFiddle - https://jsfiddle.net/maciejsikora/u5vLvxmx/

Post a Comment for "Angularjs: Prepend Html Using Directive"