错误 TS2315:类型“ElementRef"不是通用材料角度 [英] Error TS2315: Type 'ElementRef' is not generic material angular

查看:20
本文介绍了错误 TS2315:类型“ElementRef"不是通用材料角度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误在node_modules/@angular/material/button-toggle/typings/button-toggle.d.ts(136,20):

ERROR in node_modules/@angular/material/button-toggle/typings/button-toggle.d.ts(136,20):

错误 TS2315:类型ElementRef"不是通用的.

error TS2315: Type 'ElementRef' is not generic.

node_modules/@angular/material/button-toggle/typings/button-toggle.d.ts(154,104):

node_modules/@angular/material/button-toggle/typings/button-toggle.d.ts(154,104):

错误 TS2315:类型 'ElementRef' 不是通用的

error TS2315: Type 'ElementRef' is not generic

我正在尝试安装材料,但看起来是错误的.

I'm trying to install material but it looks like that's the mistake.

数据:

Angular CLI: 1.7.4
Node: 9.11.1

推荐答案

这里最好的方法是更改​​所有材质依赖项以匹配 angular 的依赖项,对于那些使用 angular 5.2.0 的人,请遵循此

The best way here is to change all your material dependencies to match that of angular for those of you who have angular 5.2.0 follow this

初始

"dependencies": {
  "@angular/core": "^5.2.0",
  "@angular/cdk": "^6.0.1",
  "@angular/material": "^6.0.1"    
}

只需将这些更改为其他角度组件的当前版本即可.

just change these to whatever the current version of the other angular components are.

最终

"dependencies": {
  "@angular/core": "^5.2.0",
  "@angular/cdk": "^5.2.0",
  "@angular/material": "^5.2.0"    
}

然后做 npm install

这篇关于错误 TS2315:类型“ElementRef"不是通用材料角度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆