components icon indicating copy to clipboard operation
components copied to clipboard

MatTree can not be created in es6

Open zonkhonk opened this issue 8 years ago • 5 comments

Bug, feature request, or proposal:

Bug

What is the expected behavior?

Should work in es6

What is the current behavior?

Throw following error

ERROR TypeError: Cannot read property 'find' of undefined at MatTree.ngOnInit (tree.js:484) at checkAndUpdateDirectiveInline (core.js:11866) at checkAndUpdateNodeInline (core.js:13394) at checkAndUpdateNode (core.js:13337) at debugCheckAndUpdateNode (core.js:14246) at debugCheckDirectivesFn (core.js:14191) at Object.eval [as updateDirectives] (TreeCheckListComponent.html:1) at Object.debugUpdateDirectives [as updateDirectives] (core.js:14180) at checkAndUpdateView (core.js:13303) at callViewAction (core.js:13654)

What are the steps to reproduce?

use an example from angular/material (https://material.angular.io/components/tree/examples) and change the compiler target to "es6" in tsconfig.json

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

"dependencies": { "@angular/animations": "^6.0.3", "@angular/cdk": "^6.2.0", "@angular/common": "^6.0.3", "@angular/compiler": "^6.0.3", "@angular/core": "^6.0.3", "@angular/forms": "^6.0.3", "@angular/http": "^6.0.3", "@angular/material": "^6.2.0", "@angular/platform-browser": "^6.0.3", "@angular/platform-browser-dynamic": "^6.0.3", "@angular/router": "^6.0.3", "core-js": "^2.5.4", "rxjs": "^6.0.0", "zone.js": "^0.8.26" }, "devDependencies": { "@angular/compiler-cli": "^6.0.3", "@angular-devkit/build-angular": "~0.6.5", "typescript": "~2.7.2", "@angular/cli": "~6.0.5", "@angular/language-service": "^6.0.3", "@types/jasmine": "~2.8.6", "@types/jasminewd2": "~2.0.3", "@types/node": "~8.9.4", "codelyzer": "~4.2.1", "jasmine-core": "~2.99.1", "jasmine-spec-reporter": "~4.2.1", "karma": "~1.7.1", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "~1.4.2", "karma-jasmine": "~1.1.1", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~5.3.0", "ts-node": "~5.0.1", "tslint": "~5.9.1" }

Is there anything else we should know?

the "_differs" constructor parameter of CdkTree is "undefined" at runtime

zonkhonk avatar May 30 '18 15:05 zonkhonk

I am facing this as well. Had the tree working under es5, but switched the target to es6 and started getting this error.

amreshprasad avatar Jun 12 '18 16:06 amreshprasad

Getting this as well. I upgraded to the latest 6.3.0 version but it still happens in there too.

chipallen2 avatar Jun 21 '18 21:06 chipallen2

I am facing this as well. Had the tree working under es5, but switched the target to es6 and started getting this error.

Same here.

es6, es2017, and es2018 all do not work. This is a serious issue.

@tinayuangao @josephperrott any thoughts?

Talador12 avatar Jul 25 '18 15:07 Talador12

This can works in production mode

liunan avatar Aug 01 '18 01:08 liunan

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.