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

查看:319
本文介绍了错误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

推荐答案

这里最好的方法是更改​​所有材质依赖关系,以使那些拥有角度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天全站免登陆