Which Angular Material version should I install to be compatible with Angular4?
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.
Let me write the steps with more details to make it easier for beginners. Though the question is specific to version 4, the answer is applicable to all versions.
I had faced some issues with latest angular material version 9 as my angular version was 8. So I had to found the compatible version of angular material. Below are the steps I followed:
1- Check the package.json file and notice the major version of angular modules. As shown below- core, compiler, common etc are having version as 8.2.14. Major version is 8.
2- Go to https://material.angular.io/ and on right hand top corner find the material version with same major version (8.2.3 in my case). Refer pic below.
3- Thus for angular v8.2.24, I found compartible angular material verison as 8.2.3. And it working with out any error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With