nsk
nsk

Reputation: 1463

After upgrade to Angular 6/Material 6 why am I facing 'mat-input-container is not a known element'?

Below code was running fine before I upgraded to 6. Not sure what changed in between! I have required modules imported as well

MatInputModule,
MatSelectModule,
MatFormFieldModule

  <mat-input-container>
    <mat-select placeholder="Sort By" formControlName="sortBy">
      <mat-option *ngFor="let sortByObject of sortByList" [value]="sortByObject.value">
        {{ sortByObject.label }}
      </mat-option>
    </mat-select>
  </mat-input-container>

Upvotes: 13

Views: 14532

Answers (2)

Rizwan
Rizwan

Reputation: 2437

This CSS class has been removed beginning version

6.0.0-beta.5 (2018-03-23)

mat-input-container has been deprecated, instead use mat-form-field

For details of breaking changes in 6.0.0-beta.5:

https://github.com/angular/material2/blob/master/CHANGELOG.md#600-beta5-2018-03-23

For details of breaking changes in general, refer:

https://github.com/angular/material2/blob/master/CHANGELOG.md

Upvotes: 29

nsk
nsk

Reputation: 1463

As per https://material.angular.io/components/form-field/overview we are now supposed to use mat-form-field

  <mat-form-field>
    <mat-select placeholder="Select">
      <mat-option value="option">Option</mat-option>
    </mat-select>
  </mat-form-field>

Upvotes: 7

Related Questions