I played with the Angular animations (fade in, fade out, etc..) but I want to display a custom loading spinner when changing from one route to another : List of products TO detail of a product (and the way back).
The spinner would have to fit in the whole <router-outlet></router-outlet>
container while the route is changing.
I did not find how to achieve that by using ONLY the animations. Is is possible please ? I only
I do something similar, but for the app loading (not for a route changing), with this code :
<app-root>
<div class="app-loading">
<div class="logo"></div>
<svg class="spinner" viewBox="25 25 50 50">
<circle class="path" cx="50" cy="50" r="20" fill="none" stroke-width="2" stroke-miterlimit="10"/>
</svg>
</div>
</app-root>
Actually, I do a workaround by displaying a message while the data is being retrieved from the API. Like this :
<div class="col-12" *ngIf="loadingEvents">
<div class="alert alert-info"><i class="fa fa-spinner fa-pulse" aria-hidden="true"></i>Loading events</div>
</div>
And the logic inside the HTTP client in the component.
But, this is not a loading spinner between route changing, it is a spinner while doing HTTP request when I am already in the next route. So, this is a code that is inside the component logic. I do not want that. I want the same concept as animations.