Unable to use MatStepper with transclusion
See original GitHub issueBug, feature request, or proposal:
Bug
What is the expected behavior?
Since there is not currently a responsive stepper, I am attempting to write a component that will switch between a horizontal and vertical stepper depending on the size of the viewport. My idea was that the responsive-stepper would not define any steps inside it. It would use *ngIf
to determine which stepper to render, and then use <ng-content>
transclusion to allow other components to include the actual steps.
What is the current behavior?
When I attempt to use <mat-step>
outside of a stepper, I get an error No provider for MatStepper
. I have set up a stackblitz reproduction of the bug, the error is visible in the console.
What are the steps to reproduce?
https://stackblitz.com/edit/angular-dfvcxd
What is the use-case or motivation for changing an existing behavior?
I’m working in an enterprise and I’d like to be able to define a responsive stepper component once, and let others reuse it in a generic fashion. I’m open to other strategies to achieve this.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Material beta 12
Is there anything else we should know?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:17
- Comments:10 (3 by maintainers)
Top GitHub Comments
any updates on this one?
@cmsImagine could you please tell us more about your solution (in code)?