elements
elements copied to clipboard
Reloading capability
We need to have reloading capability that could be called whenever a URL fails to load (maybe because of the network issues).
This is going to get so awesome in the end !
@mohammedzamakhan I'm trying to understand the use case so that it is clear to the contributor that actually implements it.
The use case I'm envisioning for this is something like:
- Specify a loading error template using the existing
errorTemplatethat can contain a button that enables reloading - When pressing the button, a reload function should be called that would retry to load the component.
Some pseudo code illustrating the example:
<ng-template #error><button (click)="() => mwcButton.retry();">retry</button></ng-template>
<mwc-button
#mwcButton
*axLazyElement="
'https://unpkg.com/wrong-url.js?module';
errorTemplate: error;
module: true
"
raised
>
Submit
</mwc-button>
So in this case the mwcButton.retry is the API we would be looking to implement.
@mohammedzamakhan @tomastrajan is this what you are thinking in terms of API and ergonomics for this feature?
Hi @felipeplets! Thanks for the suggestion.
The way I think about this is that the directive could expose .reload() method which then could be accesses using local template variable as you suggested and also using @ViewChild(AxLazyElementDirective) right ?
Service could also expose .reload(tag: string) method ?