未捕获(承诺):错误:StaticInjectorError(AppModule)[MatCell-> CdkColumnDef]

时间:2018-11-01 07:03:31

标签: angular angular-material2 angular-material-6

我正在使用Fuse Angular6材质模板。对于这个特定的代码,我会出错- ```

[
[ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[MatCell -> CdkColumnDef]: 
  StaticInjectorError(Platform: core)[MatCell -> CdkColumnDef]: 
    NullInjectorError: No provider for CdkColumnDef!
Error: StaticInjectorError(AppModule)[MatCell -> CdkColumnDef]: 
  StaticInjectorError(Platform: core)[MatCell -> CdkColumnDef]: 
    NullInjectorError: No provider for CdkColumnDef!
    at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (core.js:1034)
    at resolveToken (core.js:1271)
    at tryResolveToken (core.js:1216)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:1113)
    at resolveToken (core.js:1271)
    at tryResolveToken (core.js:1216)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:1113)
    at resolveNgModuleDep (core.js:8161)
    at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (core.js:8849)
    at resolveNgModuleDep (core.js:8161)
    at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (core.js:1034)
    at resolveToken (core.js:1271)
    at tryResolveToken (core.js:1216)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:1113)
    at resolveToken (core.js:1271)
    at tryResolveToken (core.js:1216)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:1113)
    at resolveNgModuleDep (core.js:8161)](url)](`url`)
```

代码-

app.component.html

`<table mat-table>
  <tr mat-row>
    <td mat-cell>

        <div>
          <!-- Display EwayBill Element Title -->

          <p id="neo4jframe"  *ngIf="showEwayBill">{{menuItemEWay}}</p>

          <!-- Display Neo4j Output  -->
          <br>
          <div *ngIf="showEwayBill"  id="vizEwayBill"></div>
        </div>

    </td>

  </tr>
  <br>
  <tr mat-row>
    <td mat-cell>

        <div>
          <!-- Display Collection Element Title -->
          <p id="neo4jframe" *ngIf="showCollection">{{menuItemCollection}}</p>

          <!-- Display Neo4j Output  -->
          <div *ngIf="showCollection"  id="vizCollection"></div>
        </div>

    </td>


  </tr>
</table>

` 我已经导入-

 import {MatInputModule,  MatFormFieldModule} from 
  '@angular/material';

我还想知道如何将元素-即垂直排列的元素逐层显示。在这里,我没有粘贴整个代码,但是我的其他div是水平对齐的,而不是垂直对齐的。

0 个答案:

没有答案