components icon indicating copy to clipboard operation
components copied to clipboard

Stepper with target ES6 - markForCheck Error

Open Knacktus opened this issue 8 years ago • 6 comments

Bug

Using a horizontal stepper produces an error:

ERROR TypeError: Cannot read property 'markForCheck' of undefined at MatHorizontalStepper._stateChanged (stepper.js:352)

There's a Stackoverflow question (https://stackoverflow.com/questions/48036238/stepper-angular-material-cannot-read-property-markforcheck-of-undefined) . Both workarounds do work.

What is the expected behavior?

Should work out of the box with ES6 and plain ng serve.

What are the steps to reproduce?

Here's a stackblitz, however it's working - probably they're not using plain ng serve but ng build?

https://stackblitz.com/edit/angular-ancwcw

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

ng: 7.0 ts: 3.1.3 Windows 10

EDIT: The stackblitz did not save my changes properly ... see attachment instead. angular-5furhj.zip

EDIT 2: Updated stackblitz now working. I needed to create an account to save. Same as attachement.

Knacktus avatar Oct 21 '18 05:10 Knacktus

I am experiencing the same issue. Angular: 7.0.0 Angular/Material: 7.0.0 Typescript: 3.1.3 OS: Ubuntu 16.04

My tsconfig.json file:

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "module": "es2015",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es2015",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2017",
      "dom"
    ]
  }
}

Chrome produces this error message:

ERROR TypeError: Cannot read property 'markForCheck' of undefined
    at MatHorizontalStepper._stateChanged (stepper.js:352)
    at MatStep.ngOnChanges (stepper.js:179)

Firefox produces this error message: ERROR TypeError: "this._changeDetectorRef is undefined"

Switching target back to ES5 as a workaround fix.

johanswanepoel avatar Oct 29 '18 13:10 johanswanepoel

+1

knoefel avatar Nov 08 '18 20:11 knoefel

Thanks for your issue! This is being tracked with https://github.com/angular/angular/issues/27267 now.

devversion avatar Nov 26 '18 21:11 devversion

+1

dillyboy avatar Mar 13 '19 15:03 dillyboy

+1

teom10 avatar Mar 19 '19 14:03 teom10

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.