Change 1
Angular Material no longer can be imported into your project as just one module. You must instead select all of the modules which you intend to use in the project.
Change 2 - seemingly innocuous..
The problem with upgrading between these two versions is that the Md prefix has been changed to Mat. This unfortunately now clashes with the AngularJS Material implementation... such as Md2.
We were early adopters of Angular Material, so we are still using Md2 by Promact. Originally this was used as a stopgap while essential components like the date-picker were being completed by the official Angular Material team. However, now, we wish to use both Md2 and Angular Material side by side. Especially since I was originally putting together the project with Angular 4.0.1 and now wish to upgrade to the latest.
ERROR Error: Uncaught (in promise): Error: The "mat-" prefix cannot be used in ng-material v1 compatibility mode.
To get around this you must use the "CompatibilityModule" or "NoConflictStyleCompatibilityMode" or something...?
jatkeshave commented on Oct 10, 2017
use compatibility module if you still want to use md- prefix like this
import { CompatibilityModule } from '@angular/material'; and import it in app module
if you want to use new mat- prefix which is good you can
use NoConflictStyleCompatibilityMode like this import {NoConflictStyleCompatibilityMode} from '@angular/material'; |
Issue 1 thread
Issue 2 thread and relevent comment
I tried importing from material itself but this did not clear the errors.
import { NoConflictStyleCompatibilityMode } from '@angular/material';
Instead the solution seems to be to import and therefore invoke the NoConflictStleCompatibilityMode from MD2.
import { Md2Module, NoConflictStyleCompatibilityMode } from 'md2';
This makes sense because the use of mat in an angular/material v1 context can no only be in the MD2 project.
No comments:
Post a Comment