question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

mat-horizontal-stepper: Unable to set linear=true

See original GitHub issue

Bug, feature request, or proposal:

Bug

What is the expected behaviour?

Stepper is linear and doesn’t produce the below error.

What is the current behavior?

Stepper component throws errors when linear parameter is set to true. Tested with dynamically generated steps and non-dynamic steps and same error occurs.

ERROR TypeError: Cannot read property 'invalid' of undefined
    at eval (VM808 cdk-stepper.umd.js:375)
    at Array.some (<anonymous>)
    at MatHorizontalStepper.CdkStepper._anyControlsInvalid (VM808 cdk-stepper.umd.js:375)
    at MatHorizontalStepper.set [as selectedIndex] (VM808 cdk-stepper.umd.js:206)
    at MatHorizontalStepper.set [as selected] (VM808 cdk-stepper.umd.js:230)
    at MatStep.CdkStep.select (VM808 cdk-stepper.umd.js:125)
    at Object.eval [as handleEvent] (VM994 MatHorizontalStepper.ngfactory.js:26)
    at handleEvent (VM801 core.umd.js:12055)
    at callWithDebugContext (VM801 core.umd.js:13525)
    at Object.debugHandleEvent [as handleEvent] (VM801 core.umd.js:13113)
    at dispatchEvent (VM801 core.umd.js:8647)
    at eval (VM801 core.umd.js:9258)
    at HTMLElement.eval (VM791 platform-browser.umd.js:2685)
    at e.invokeTask (VM1088 zone.min.js:1)
    at Object.onInvokeTask (VM801 core.umd.js:3913)

What are the steps to reproduce?

Recreated basic Stepper component in this plunker with a few example: http://plnkr.co/edit/mES0H2nKfYjfcrUOHexz

What is the use-case or motivation for changing an existing behavior?

N/A

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

angular/material 2.0.0-beta.12

Is there anything else we should know?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:3
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
pylecommented, Oct 11, 2017

Ahh I see. So in my case, I don’t want to treat the stepper as a form but rather listen to the selectionChange events and use routes; I could just create a dummy AbstractControl for this but it seems a little wasteful.

3reactions
yusijscommented, Oct 25, 2017

I’m seeing the same (or at least a similar) issue. I want some steps to be mandatory, and others to be optional. However, optional=true does nothing, and I still get the error described in the OP. Am I completely misreading the docs, or is there something off here?

Read more comments on GitHub >

github_iconTop Results From Across the Web

mat-horizontal-stepper: Unable to set linear=true #7699
Configure SystemJS --> <script src="systemjs.config.js"></script> ... using ngFor </div> <mat-horizontal-stepper [linear]="isLinear"> <mat-step *ngFor="let ...
Read more >
Angular Stepper with selectedIndex set matStepperNext ...
Im using a matStepper and when i set the selectedIndex to 3 i ... <mat-horizontal-stepper #stepper [linear]="true" [selectedIndex]="this.
Read more >
Mat-Stepper - How to use the Linear Mode? - Google Groups
I have defined a set of steps. Now, my program is working perfectly after a few days of struggle. However, I have set...
Read more >
Material Stepper Without Form But Validating - StackBlitz
<mat-horizontal-stepper [linear]="true". #stepper>. <mat-step [stepControl]="valid1"> ... false)">set valid</button>. <button (click)="setState(valid1,true).
Read more >
Can I Programmatically Move The Steps Of A Mat-Horizontal ...
<mat-horizontal-stepper [linear]"isLinear" #stepper> <mat-step> <form> ... When I set my stepper with linear'true', I still can go through the steps by ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found