随着Angular Material及其
breaking changes的新更新,我无法再使用我的< md-menu>组件.我在导入MaterialModule时工作,但现在导入MatMenuModule或MdMenuModule时会产生以下错误:
compiler.es5.js:1690 Uncaught Error: Template parse errors: There is no directive with "exportAs" set to "matMenu" (" </mat-toolbar> <mat-menu xPosition="after" [ERROR ->]#wordListMenu="matMenu" ): ng:///NavbarModule/NavbarComponent.html@38:28
我遵循documentation的指南和API,但语法似乎已经改变了?我已经尝试了#wordListMenu =“matMenu”和#wordListMenu =“mdMenu”并且错误仍然存在.
我的html文件(相关部分)是:
<button mat-button [md-menu-trigger-for]="wordListMenu" [ngClass]="{'active' : isActive(['/wordlist'])}"> Word Lists </button> <mat-menu xPosition="after" #wordListMenu="matMenu" [overlapTrigger]="false"> //Content of menu </mat-menu>
我的模块是:
import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import {NavbarComponent} from 'app/navbar/navbar.component'; import { MdTooltipModule,MatMenuModule } from '@angular/material'; @NgModule({ imports: [ CommonModule,MdTooltipModule,MatMenuModule ],declarations: [NavbarComponent],exports: [NavbarComponent] }) export class NavbarModule { }
有什么我想念的吗?为什么编译器不识别matMenu?
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。