Closed
Description
Bug, feature request, or proposal:
feature request-ish
What is the expected behavior?
Each step in the stepper should have the option to be lazily rendered
What is the current behavior?
Currently every step is initialized when the stepper is loaded
What is the use-case or motivation for changing an existing behavior?
Inactive steps can have logic that fetches data or does some work that isn't relevant to the current step.
Currently there isn't any mention of how to achieve this in the stepper. However it can be done via <ng-container *ngIf="condition">
, not sure if there are any side effects.
<mat-horizontal-stepper>
<mat-step>
<ng-container *ngIf="condition">
...
</ng-container>
</mat-step>
</mat-horizontal-stepper>
The expansion panel supports lazy rendering "officially" https://material.angular.io/components/expansion/overview#lazy-rendering
<mat-expansion-panel>
<mat-expansion-panel-header>
This is the expansion title
</mat-expansion-panel-header>
<ng-template matExpansionPanelContent>
Some deferred content
</ng-template>
</mat-expansion-panel>
Why is there a difference? If the <ng-container>
is a perfectly fine solution why doesn't the expansion panel do it the same way? Why is there no mention of lazy rendering in the stepper doc?
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 6.1.2
Node: 9.10.1
OS: win32 x64
Angular: 6.1.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.7.1
@angular-devkit/build-angular 0.7.1
@angular-devkit/build-optimizer 0.7.1
@angular-devkit/build-webpack 0.7.1
@angular-devkit/core 0.7.1
@angular-devkit/schematics 0.7.1
@angular/cdk 6.4.2
@angular/cli 6.1.2
@angular/flex-layout 6.0.0-beta.17
@angular/material 6.4.2
@ngtools/webpack 6.1.1
@schematics/angular 0.7.2
@schematics/update 0.7.2
rxjs 6.2.2
typescript 2.9.2
webpack 4.9.2