Angular Material 2工具提示问题

时间:2018-11-22 15:44:52

标签: javascript html angular typescript angular-material

我只是将工具提示添加到div中,就像这样:

<div  matTooltip="yeayh">
</div>

并将下面的2个模块添加到父模块:

BrowserAnimationsModule,
MatTooltipModule,

显示的工具提示没有问题,但是我在浏览器控制台中看到了它:

ERROR TypeError: Cannot read property 'matches' of null
    at Object.eval [as updateRenderer] (TooltipComponent.html:1)
    at Object.debugUpdateRenderer [as updateRenderer] (core.js:11087)
    at checkAndUpdateView (core.js:10463)
    at callViewAction (core.js:10699)
    at execComponentViewsAction (core.js:10641)
    at checkAndUpdateView (core.js:10464)
    at callViewAction (core.js:10699)
    at execEmbeddedViewsAction (core.js:10662)
    at checkAndUpdateView (core.js:10459)
    at callViewAction (core.js:10699)

2 个答案:

答案 0 :(得分:3)

尝试更改“ @ angular / cdk”版本(例如“ ^ 6.0.0”)

答案 1 :(得分:0)

尝试将角形材料更新为新版本7.2.1 参见说明angulat material install

然后将CSS添加到文件“ \ src \ styles.css”

@import'@ angular / material / prebuilt-themes / deeppurple-amber.css';