elements icon indicating copy to clipboard operation
elements copied to clipboard

Reloading capability

Open mohammedzamakhan opened this issue 6 years ago • 3 comments

We need to have reloading capability that could be called whenever a URL fails to load (maybe because of the network issues).

mohammedzamakhan avatar Aug 31 '19 16:08 mohammedzamakhan

This is going to get so awesome in the end !

tomastrajan avatar Aug 31 '19 18:08 tomastrajan

@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 errorTemplate that 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?

felipeplets avatar Sep 28 '20 13:09 felipeplets

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 ?

tomastrajan avatar Oct 22 '20 15:10 tomastrajan