模板解析错误:没有将“ exportAs”设置为“ matMenu”的指令

时间:2019-04-04 16:47:32

标签: angular unit-testing

我正在为角度应用程序运行单元测试。我正在

Component should create FAILED
        Error: Template parse errors:
        There is no directive with "exportAs" set to "matMenu" ("
                  <span flex>{{dateRange}}</span>
                </button>
                <mat-menu [ERROR ->]#menu="matMenu">
                  <button *ngFor="let dataRange of dataRanges" (click)="onDateRange(dataRan"): ng:///DynamicTestModule/TransactionsComponent.html@18:18
        There is no directive with "exportAs" set to "matMenu" ("customFilterData">Custom ></button>
                </mat-menu>
                <mat-menu class="date-range-menu" [ERROR ->]#dateTimeMenu="matMenu">
                  <ngbd-datepicker-range style="font-size:16px;font-family:ffunit;""): ng:///DynamicTestModule/TransactionsComponent.html@22:42
        There is no directive with "exportAs" set to "matMenu" ("
                  <span flex>Add filter</span>
                </button>
                <mat-menu style="width:50px;" [ERROR ->]#menuFilter="matMenu">
                  <button *ngFor="let header of filterHeaders; let i = index" (click)"): ng:///DynamicTestModule/TransactionsComponent.html@31:38
            at syntaxError (./node_modules/@angular/compiler/fesm5/compiler.js?:1275:17)
            at TemplateParser.parse (./node_modules/@angular/compiler/fesm5/compiler.js?:15084:19)
            at JitCompiler._parseTemplate (./node_modules/@angular/compiler/fesm5/compiler.js?:24272:37)
            at JitCompiler._compileTemplate (./node_modules/@angular/compiler/fesm5/compiler.js?:24259:23)
            at eval (./node_modules/@angular/compiler/fesm5/compiler.js?:24202:62)
            at Set.forEach (<anonymous>)
            at JitCompiler._compileComponents (./node_modules/@angular/compiler/fesm5/compiler.js?:24202:19)
            at eval (./node_modules/@angular/compiler/fesm5/compiler.js?:24120:19)
            at Object.then (./node_modules/@angular/compiler/fesm5/compiler.js?:1266:77)
            at JitCompiler._compileModuleAndAllComponents (./node_modules/@angular/compiler/fesm5/compiler.js?:24118:26)
        Error: Template parse errors:
        There is no directive with "exportAs" set to "matMenu" ("
                  <span flex>{{dateRange}}</span>
                </button>
                <mat-menu [ERROR ->]#menu="matMenu">
                 ......
                 ......bla bla ....

有什么想法吗?

0 个答案:

没有答案