Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Table] Does not work when targetting ES6 #9329

Closed
MaddMugsy opened this issue Jan 11, 2018 · 18 comments · Fixed by #10982, #11252 or #12759
Closed

[Table] Does not work when targetting ES6 #9329

MaddMugsy opened this issue Jan 11, 2018 · 18 comments · Fixed by #10982, #11252 or #12759
Assignees
Labels
P2 The issue is important to a large percentage of users, with a workaround

Comments

@MaddMugsy
Copy link

MaddMugsy commented Jan 11, 2018

Bug, feature request, or proposal:

Bug

What is the expected behavior?

Table appears in browser.

What is the current behavior?

Table doesn't appear. Error message in console:

ERROR TypeError: Cannot read property 'nativeElement' of undefined
    at new CdkTable (table.js:438)
    at new MatTable (table.js:26)
    at createClass (core.js:10365)
    at createDirectiveInstance (core.js:10212)
    at createViewNodes (core.js:11672)
    at callViewAction (core.js:12106)
    at execComponentViewsAction (core.js:12015)
    at createViewNodes (core.js:11700)
    at createRootView (core.js:11561)
    at callWithDebugContext (core.js:12927)

What are the steps to reproduce?

Create a new angular 5 project. Add the example code from material.angular.io for mat-table.

It should run fine.

Now go into tsconfig.json and target something higher than es5. Boom.

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

Projects targeting > es5.

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

Angular 5+, Material 5-rc0 - 5.0.4, TS 2.4.2
Windows 7 64bit
Chrome

@NaifousBS
Copy link

Same issue

@andrewseguin
Copy link
Contributor

Looks like this is an issue in the Angular compiler. The MatTable extends CdkTable and should receive the same constructor dependency injection. Unfortunately this does not seem to be the case when targetting ES6. See the open issue for more information.

@andrewseguin andrewseguin changed the title Bug: mat-table TypeError when targeting >es5 [Table] Does not work when targetting ES6 Jan 23, 2018
@andrewseguin andrewseguin added the P4 A relatively minor issue that is not relevant to core functions label Jan 23, 2018
@wiedikerli
Copy link

This should have a higher priority...

@lacolaco
Copy link
Contributor

also relate to #9813

@andrewseguin
Copy link
Contributor

Looks like the fix has been made in Angular

@Markus-Ende
Copy link

Have the same error with angular 5.2.9 and material 5.2.4.
@andrewseguin which version did you try?

@andrewseguin
Copy link
Contributor

@Markus-Ende Confirmed that this issue is still present in v5 and v6 :(

@andrewseguin andrewseguin reopened this Apr 24, 2018
@andrewseguin andrewseguin added P2 The issue is important to a large percentage of users, with a workaround and removed P4 A relatively minor issue that is not relevant to core functions labels Apr 24, 2018
@andrewseguin
Copy link
Contributor

Cool bug - we are using Angular's compiler-cli to bundle up our es6 code. It uses tsickle, but the version it is on does not know how to support this case.

angular/tsickle#760

I'm updating the compiler-cli to the version that will support this: angular/angular#23531

In the meantime, I'm going to create a pull request that forces this to be fixed in our code. Thanks for reporting that the issue is still here. Turns out the other PR was something of a coincidence

@andrewseguin
Copy link
Contributor

Re-opening, looks like the issue is occurring on the row defs as well

@TzuHuanTai
Copy link

the issue is occurring on the mat tree too

@WilliamCrossSkymantics
Copy link

Has this issue been fixed for MatRowDefs? We are currently getting what seems to be the same bug, and have updated to the most recent version of Material

Error context:

ERROR TypeError: Cannot read property 'find' of undefined
at MatRowDef.ngOnChanges (table.js:324)
at checkAndUpdateDirectiveInline (core.js:11642)
at checkAndUpdateNodeInline (core.js:13252)
at checkAndUpdateNode (core.js:13191)
at debugCheckAndUpdateNode (core.js:14147)
at debugCheckDirectivesFn (core.js:14090)
at Object.eval [as updateDirectives] (GateagentComponent.html:69)
at Object.debugUpdateDirectives [as updateDirectives] (core.js:14078)
at checkAndUpdateView (core.js:13156)
at callViewAction (core.js:13521)

Angular CLI: 6.0.8
Node: 8.11.3
OS: win32 x64
Angular: 6.1.2
... animations, common, core, forms, http, platform-browser
... platform-browser-dynamic, router

Package Version

@angular-devkit/architect 0.6.8
@angular-devkit/build-angular 0.6.8
@angular-devkit/build-optimizer 0.6.8
@angular-devkit/core 0.6.8
@angular-devkit/schematics 0.6.8
@angular/cdk 6.4.3
@angular/cli 6.0.8
@angular/compiler 6.1.0
@angular/compiler-cli 6.1.0
@angular/language-service 6.1.0
@angular/material 6.4.3
@ngtools/webpack 6.0.8
@schematics/angular 0.6.8
@schematics/update 0.6.8
rxjs 6.2.2
typescript 2.9.2
webpack 4.8.3

Browser: Chrome

@Lukespacewalker
Copy link

@WilliamCrossSkymantics you need to revert angular material to 6.4.1 to mitigate the issue.

@WilliamCrossSkymantics
Copy link

Excellent, that fixed the issue. Thanks @Lukespacewalker!

@ghost
Copy link

ghost commented Aug 18, 2018

I am also facing the same issue while using material table in my project, here is the error message,

ERROR TypeError: Cannot read property 'find' of undefined at MatHeaderRowDef.ngOnChanges (table.js:324) at MatHeaderRowDef.ngOnChanges (table.js:376) at checkAndUpdateDirectiveInline (core.js:11642) at checkAndUpdateNodeInline (core.js:13252) at checkAndUpdateNode (core.js:13191) at debugCheckAndUpdateNode (core.js:14147) at debugCheckDirectivesFn (core.js:14090) at Object.eval [as updateDirectives] (LocationInfoWindowComponent.html:18) at Object.debugUpdateDirectives [as updateDirectives] (core.js:14078) at checkAndUpdateView (core.js:13156)

Development Environment:

Angular CLI: 6.1.3
Node: 8.10.0
OS: linux x64
Angular: 6.1.2

Package Version:
"dependencies": {
"@agm/core": "^1.0.0-beta.3",
"@agm/snazzy-info-window": "^1.0.0-beta.3",
"@angular/animations": "^6.0.5",
"@angular/cdk": "^6.2.1",
"@angular/common": "^6.0.5",
"@angular/compiler": "^6.0.5",
"@angular/core": "^6.0.5",
"@angular/flex-layout": "^6.0.0-beta.16",
"@angular/forms": "^6.0.5",
"@angular/http": "^6.0.5",
"@angular/material": "^6.2.1",
"@angular/material-moment-adapter": "^6.3.1",
"@angular/platform-browser": "^6.0.5",
"@angular/platform-browser-dynamic": "^6.0.5",
"@angular/router": "^6.0.5",
"@ng-bootstrap/ng-bootstrap": "^2.0.0",
"@ngx-translate/core": "^10.0.1",
"@ngx-translate/http-loader": "^3.0.1",
"@swimlane/ngx-charts": "^8.1.0",
"@types/googlemaps": "^3.30.8",
"angular-material": "^1.1.9",
"chart.js": "^2.7.2",
"core-js": "^2.5.5",
"font-awesome": "^4.7.0",
"hammerjs": "^2.0.8",
"moment": "^2.22.2",
"ng2-charts": "^1.6.0",
"ng4-loading-spinner": "^1.1.3",
"ngx-loading": "^1.0.14",
"ngx-toastr": "^8.8.0",
"npm": "^6.1.0",
"rxjs": "^6.2.1",
"rxjs-compat": "^6.0.0-rc.0",
"snazzy-info-window": "^1.1.1",
"yarn": "^1.6.0",
"zone.js": "^0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.6.8",
"@angular/cli": "^6.0.8",
"@angular/compiler-cli": "^6.0.5",
"@angular/language-service": "^6.0.5",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^9.6.1",
"codelyzer": "~4.2.1",
"jasmine-core": "~3.1.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^2.0.4",
"karma-chrome-launcher": "~2.2.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.4.2",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^1.0.0",
"protractor": "~5.3.0",
"ts-node": "~5.0.1",
"tslint": "~5.9.1",
"typescript": "~2.7.0"
}

Browser : Chrome and Firefox

@TzuHuanTai
Copy link

@AnilGoudar
use "ng serve --aot" can work, JIT will get this issue

@jelbourn jelbourn reopened this Aug 20, 2018
@jelbourn jelbourn assigned devversion and unassigned andrewseguin Aug 20, 2018
devversion added a commit to devversion/material2 that referenced this issue Aug 20, 2018
Fixes that the table does not render properly when used inside of a ES2015 application. This is due to an ongoing Angular issue which has been caused due to a brittle Regex check [introduced here](angular/angular#22356 (comment)) that should be replaced with a more clean approach for identifying classes that inherit metadata from another class.

* angular/angular#22642
* angular/tsickle#760

Fixes angular#9329
devversion added a commit to devversion/material2 that referenced this issue Aug 20, 2018
Fixes that some components does not render properly when used inside of a ES2015 JIT application. This is due to an ongoing Angular issue which has been caused due to a brittle Regex check [introduced here](angular/angular#22356 (comment)) that should be replaced with a more clean approach for identifying classes that inherit metadata from another class.

* angular/angular#22642
* angular/tsickle#760

See the more detailed issue here: angular#12760

Fixes angular#9329.
jelbourn pushed a commit that referenced this issue Aug 21, 2018
Fixes that some components does not render properly when used inside of a ES2015 JIT application. This is due to an ongoing Angular issue which has been caused due to a brittle Regex check [introduced here](angular/angular#22356 (comment)) that should be replaced with a more clean approach for identifying classes that inherit metadata from another class.

* angular/angular#22642
* angular/tsickle#760

See the more detailed issue here: #12760

Fixes #9329.
@hopsinat
Copy link

In the beginning i got the same errors as OP so i downgraded my @angular/material to 6.4.1 which needed @angular/cdk to be 6.4.1 too, so i did that. The errors where gone but now i get this error:
ERROR TypeError: Cannot read property 'runOutsideAngular' of undefined
at new MatDrawer (sidenav.js:177)
at new MatSidenav (sidenav.js:856)

this seems so random, like Angular always wants to find a new error :(

@hopsinat
Copy link

i ran the following command which worked: ng serve --aot --port 1234
This worked literally for a few minutes, after i pressed CTRL F5 for the fourth time it threw a wall full of errors. Why? For no reason - all i changed was css and html.

jelbourn pushed a commit that referenced this issue Aug 29, 2018
Fixes that some components does not render properly when used inside of a ES2015 JIT application. This is due to an ongoing Angular issue which has been caused due to a brittle Regex check [introduced here](angular/angular#22356 (comment)) that should be replaced with a more clean approach for identifying classes that inherit metadata from another class.

* angular/angular#22642
* angular/tsickle#760

See the more detailed issue here: #12760

Fixes #9329.
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P2 The issue is important to a large percentage of users, with a workaround
Projects
None yet