devyumao / angular2-busy

Show busy/loading indicators on any promise, or on any Observable's subscription.
http://devyumao.github.io/angular2-busy/demo/asset/
MIT License
314 stars 102 forks source link

show indicator inside the element its defined on #79

Closed Arikael closed 7 years ago

Arikael commented 7 years ago

Hi

I just tried angular2-busy and was rather surprised to find out that all components are not created inside the element I define ngBusy on but afterwards which means that I have to wrap my element inside another parent element with position: relative. So I have to have at least two <div>

Why are the angular2-busy components not rendered inside the element ngBusy is defined on?

Arikael commented 7 years ago

ok, after some digging, this seems to be "by (angular) design" as described here https://github.com/angular/angular/issues/9035 https://stackoverflow.com/questions/38093727/angular2-insert-a-dynamic-component-as-child-of-a-container-in-the-dom

the solution as described by antoines post in the stackoverflow post would be to do the following

<div>
   <ng-template [ngBusy]="busy"></ng-template>
</div>

this works, but angular's naming int this case feels very counter intuitive. And without deeper knowledge of angular's inner workings the whole process of including a dynamic component feels like that.