【问题标题】:Angular Material table throws nativeElement undefinedAngular Material 表抛出 nativeElement undefined
【发布时间】:2020-08-10 16:58:05
【问题描述】:

我正在尝试让一个非常基本的 Material 表在 Angular 8 中工作。组件不呈现,我在控制台日志中发现以下异常:

ERROR 错误:未捕获(承诺中):TypeError:无法读取未定义的属性“nativeElement”

这似乎是一个常见错误。有没有人设法解决这个问题?

https://github.com/angular/components/issues/9813

【问题讨论】:

    标签: angular-material2 angular-material-table


    【解决方案1】:

    将 tsconfig.json 中的目标属性更新为 es5

      "compilerOptions": 
        {
     "sourceMap": true, 
        "declaration": false,
         "moduleResolution": "node",
     "emitDecoratorMetadata": true,
     "experimentalDecorators": true,
         "target": "es5",
         "typeRoots": [ "node_modules/@types" ], 
        "lib": [ "es2017", "dom" ] 
        }
    

    【讨论】:

    • 我已经尝试过了,不幸的是它没有任何区别。
    猜你喜欢
    • 1970-01-01
    • 2018-06-15
    • 2019-01-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-28
    • 1970-01-01
    • 2018-09-11
    相关资源
    最近更新 更多