ERROR in Assertion error: failed to find directive with exportAs: matTooltip
Reproduction
Use StackBlitz to reproduce your issue: https://stackblitz.com/fork/components-issue
Steps to reproduce:
-
Create a new project using Angular CLI 8.3.3
-
Open tsconfig.app.json and set ivy to true
"angularCompilerOptions": { "enableIvy": true } -
Add <mat-icon #tooltip="matTooltip" matTooltip="123" matTooltipPosition="right"> info_outline to app.component.html
-
Import MatTooltipModule, MatIconModule, FileUploadModule in app.module.ts
-
run "ng build --aot"
-
you will see ERROR in Assertion error: failed to find directive with exportAs: matTooltip error
Expected Behavior
What behavior were you expecting to see?
No error
Actual Behavior
What behavior did you actually see?
ERROR in Error: Assertion error: failed to find directive with exportAs: matTooltip
at C:\ng-test\project825\node_modules@angular\compiler\bundles\compiler.umd.js:28628:31
at Array.forEach (
Environment
- Angular:
- CDK/Material:
- Browser(s):
- Operating System (e.g. Windows, macOS, Ubuntu):
Windows 10 Node version v12.4.0 NPM version 6.9
This is my package.json
{ "name": "project825", "version": "0.0.0", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@angular/animations": "9.0.0-next.6", "@angular/common": "9.0.0-next.6", "@angular/compiler": "9.0.0-next.6", "@angular/core": "9.0.0-next.6", "@angular/forms": "9.0.0-next.6", "@angular/platform-browser": "9.0.0-next.6", "@angular/platform-browser-dynamic": "9.0.0-next.6", "@angular/router": "9.0.0-next.6", "@angular/material": "^8.2.0", "@angular/cdk": "^8.2.0", "ng2-file-upload": "^1.3.0", "rxjs": "^6.5.3", "tslib": "^1.10.0", "zone.js": "~0.10.2" }, "devDependencies": { "@angular-devkit/build-angular": "~0.803.3", "@angular/cli": "9.0.0-next.4", "@angular/compiler-cli": "9.0.0-next.6", "@angular/language-service": "9.0.0-next.6", "@types/jasmine": "~3.3.13", "@types/node": "~12.7.5", "codelyzer": "^5.0.1", "jasmine-core": "~3.4.0", "jasmine-spec-reporter": "~4.2.1", "karma": "~4.1.0", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "^2.0.5", "karma-jasmine": "~2.0.1", "karma-jasmine-html-reporter": "^1.4.2", "protractor": "^5.4.2", "ts-node": "~8.3.0", "tslint": "~5.20.0", "typescript": "3.5.3" } }
Judging based on the code provided in step 3, it seems like you haven't set the matTooltip attribute.
Judging based on the code provided in step 3, it seems like you haven't set the
matTooltipattribute.
@crisbeto you are right, I didn't paste the full code, I've update the my report above.
I've been playing around, it seems importing ng2-file-upload library (FileUploadModule) to app.module caused this, this was not an issue when ivy is disabled.
I can't figure out why ng2-file-upload caused ivy compilation issue for material.
It seems ng2-file-upload is not compatible with ivy, causing material to throw errors. The error is very misleading, it didn't mention the library in question at all. I spent a whole day to test library by library to see which one causes the issue. I guess that is ivy team's issue. Therefore closing this issue. Thanks
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.