Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uncaught TypeError: Class constructor Platform cannot be invoked without 'new'

I've installed the Angular CDK in order to use PrimeNG's dropdown component but it throws an error.

I've added this in my app.module.ts:

import {DropdownModule} from 'primeng/dropdown';

And installed the Angular CDK by simply typing in the following:

npm install @angular/cdk --save
like image 770
Haagii95 Tugs Avatar asked Jun 26 '20 07:06

Haagii95 Tugs


2 Answers

I had the same issue. Check your cdk version in your package.json

I solved installing an older version of cdk 10:

npm i @angular/[email protected] --save
like image 80
Gennaro Schiano Avatar answered Nov 02 '22 15:11

Gennaro Schiano


In case someone has the same issue while trying to implement material design with angular material, rollback both material and cdk packages to an older version with:

npm i @angular/[email protected] @angular/[email protected] --save

I hope someone proposes a better approach that enables using the latest versions.

like image 3
Fito Avatar answered Nov 02 '22 15:11

Fito