Skip to content

Commit

Permalink
feat(ngx-material-pages): supporting lazy loading for each page
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyNahas committed May 15, 2018
1 parent 3f9dc7f commit e78441b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@
</mat-toolbar>
<div class="demo-sidenav-content main-container">

<mat-tab-group [selectedIndex]="index" style="min-height: 15vh;" class="hide-deep">
<mat-tab-group [selectedIndex]="index" style="min-height: 15vh;" >
<button mat-fab color="warn" (click)="previous()">
<mat-icon>location</mat-icon>
</button>
<mat-tab *ngFor="let page of pages;let i = index;" class="test124">
<ng-container [ngTemplateOutlet]="page.pageContent.content"></ng-container>
<mat-tab *ngFor="let page of pages;let i = index;">
<ng-template matTabContent>
<ng-container [ngTemplateOutlet]="page.pageContent.content"></ng-container>
</ng-template>
</mat-tab>
</mat-tab-group>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ export class NgxMaterialPagesComponent implements OnInit, AfterContentInit {
next() {
this.index = this.index === this.totalPages - 1 ? this.totalPages - 1 : ++this.index;
this.pageChanged.emit(this.index);

if (this.index === this.totalPages - 1) {
this.done.emit();
}
}


Expand All @@ -97,6 +101,7 @@ export class NgxMaterialPagesComponent implements OnInit, AfterContentInit {
*
*/
onStepSelectionChange(event: StepperSelectionEvent) {
console.log('onStepSelectionChanged');
this.index = event.selectedIndex;
this.pageChanged.emit(this.index);
}
Expand Down

0 comments on commit e78441b

Please sign in to comment.