0

I was implementing mat-select and mat-option for one of the requirement but seems like it conflicts with some of the existing functionalities.

Very first, can anyone help me if I can get @angular/material in angular 4, the one which I installed has version 6.4.7. Is there any version supporting angular 4.0.0 because currently we have no plan to upgrade our application to angular 6.

Once I installed angular/material with below command :

 npm install --save @angular/material @angular/cdk @angular/animations

it stated throwing below error:

 node_modules/@angular/material/core/typings/line/line.d.ts (23,55): Type 'ElementRef' is not generic.
 node_modules/@angular/cdk/portal/typings/portal.d.ts (50,39): ',' expected.
 node_modules/@angular/cdk/portal/typings/portal.d.ts (50,41): Type parameter name cannot be 'any'
 node_modules/@angular/cdk/portal/typings/dom-portal-outlet.d.ts (34,37): Generic type 'TemplatePortal<C, any>' requires 2 type argument(s).
 node_modules/@angular/material/bottom-sheet/typings/bottom-sheet-container.d.ts (23,24): Generic type 'MatBottomSheetConfig<D, any>' requires 2 type argument(s).

Looks like this is version issue, but can anyone guide me what would be the solution for this?

Adding my code in this question:

shared.module.ts file

import { MatFormFieldModule, MatInputModule, MatSelectModule } from '@angular/material';
@NgModule({
imports: [ ....,
MatInputModule,
MatFormFieldModule,
MatSelectModule,
...]

exports: [ ....,
MatInputModule,
MatFormFieldModule,
MatSelectModule,
....]

app.module.ts file

import { SharedModule } from './shared';
@NgModule({
imports: [ ...,
 SharedModule,
  ....]

Actually it does not even hit the code, as soon as I install angular/material and angular/cdk my ng build fails with above error.

Mehul
  • 25
  • 6
  • share your code please – Chellappan வ Sep 19 '18 at 18:56
  • It seems there are incongruences between the angular version and material version. For Angular 4.x you can use the Angular Material 5.x versions. https://material.angular.io/guide/getting-started – Kalamarico Sep 20 '18 at 00:50
  • I think that for Angular 4.x you would need to use Angular Material 2.0.0-beta.12. Angular Material 5.x requires Angular 5.x. – G. Tranter Sep 20 '18 at 19:15

0 Answers0