问题描述
错误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'不是通用材料角的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!