typescript - How to implement a loading spinner on content change with the ASP.NET Core Angular SPA template? -
i setup toy project based on angular template asp.net core 2.0 in order create spa testing purposes:
- https://github.com/aspnet/javascriptservices/tree/dev/templates/angularspa
- https://blogs.msdn.microsoft.com/webdev/2017/02/14/building-single-page-applications-on-asp-net-core-with-javascriptservices/
i know server pre-rendering process making things lot faster spa in case of latency.
but still how achieve this? can automatized (like applicable views when coded on client side (!*.cshtml)) ?
thanks
if want spinner on route changes, can set flag part of router events:
checkrouterevent(routerevent: event): void { if (routerevent instanceof navigationstart) { this.loading = true; } if (routerevent instanceof navigationend || routerevent instanceof navigationcancel || routerevent instanceof navigationerror) { this.loading = false; } } then turn on/off spinner based on flag.
in html:
<span class="glyphicon glyphicon-refresh glyphicon-spin spinner" *ngif="loading"></span> i have working example set here: https://github.com/deborahk/angular-routing (in apm-final folder).
Comments
Post a Comment