Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError: core.defineInjectable is not a function while using angular material/cdk in angular 4.3.2

I want to use angular material progress spinner and added

import {MatProgressSpinnerModule} from '@angular/material';

Added in imports array and in component

Haven't tried both updating the template with selector and removing it. In either case getting the error.

I am using system.config.js, and added map values for all the angular material and cdk js files.

Using angular 4.3.2 and angular material latest version. Getting this below error.

errors.ts:42 ERROR Error: Uncaught (in promise): Error: TypeError: core.defineInjectable is not a function at eval (http://localhost:8000/node_modules/@angular/cdk/bundles/cdk-bidi.umd.js:89:62) at Object.eval (http://localhost:8000/node_modules/@angular/cdk/bundles/cdk-bidi.umd.js:91:2) Error loading http://localhost:8000/app/UMSClient/com/ipc/ums/modules/EnterpriseTree/Enterprise.module.js at eval (http://localhost:8000/node_modules/@angular/cdk/bundles/cdk-bidi.umd.js:89:62) at Object.eval (http://localhost:8000/node_modules/@angular/cdk/bundles/cdk-bidi.umd.js:91:2) Error loading http://localhost:8000/app/UMSClient/com/ipc/ums/modules/EnterpriseTree/Enterprise.module.js

What could be wrong?

Thanks,

like image 755
Rajesh Avatar asked Mar 06 '23 03:03

Rajesh


2 Answers

defineInjectable is an angular 6 only function. You may have been using the newest version of Angular Material and it isn't compatible with your current version (4.3.2).

like image 176
Kellie Hall Avatar answered Mar 14 '23 21:03

Kellie Hall


I was getting this error on Stackblitz using Angular Material so I refreshed the dependancies and downgraded core-js to 2.6.9

core-js @ 2.6.9

like image 21
Andrew Allen Avatar answered Mar 14 '23 21:03

Andrew Allen