我应该安装哪个 Angular Material 版本才能与 Angular4 兼容? [英] Which Angular Material version should I install to be compatible with Angular4?
问题描述
我应该安装哪个 Angular Material 版本才能与 Angular4 兼容?
Which Angular Material version should I install to be compatible with Angular4?
我使用以下命令在 Angular 4 项目的顶部安装了 angular Material.
I have used below command to install angular Material on the top of Angular 4 project.
npm install @angular/materail
npm install @angular/cdk
npm install @angular/animations
当我尝试运行该应用程序时,出现以下错误.
While I try to run the app I am getting below error.
/node_modules/@angular/cdk/observers/typings/observe-content.d.ts (33,22): Type 'ElementRef' is not generic.
推荐答案
我建议您将项目更新到最新版本的 angular.出于稳定性、功能和性能原因.此外,查找有关此类旧版本的文档/指南要困难得多.
I would advise you to update your project to the latest version of angular. For stability, features and performance reasons. Also finding documentation/guides about such old version is a lot more difficult.
除此之外,如果你想为这么老的angular版本安装素材,你应该使用2.0.0-beta.12
版本,它与angular 4兼容:
Besides that, if you want to install material for such an old angular version, you should use the 2.0.0-beta.12
version, which is compatible with angular 4:
npm install @angular/material@2.0.0-beta.12
这篇关于我应该安装哪个 Angular Material 版本才能与 Angular4 兼容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!