Changelog of beta.11 says the md prefix is being deprecated everywhere, in favor of mat.
So I refactored all my project to move from md to mat for :
MdInputModule > MatInputModule)<md-slider> > <mat-slider>)mdInput > matInput)But doing so, everything break with this error :
The "mat-" prefix cannot be used in ng-material v1 compatibility mode.
I saw in angular-prefix-adapter that compatibility mode should be activated :
{provide: MATERIAL_COMPATIBILITY_MODE, useValue: true}
But it looks like a bug to me : why is this an error by default if this is supposed to be the new official prefix ?
And even without this change, why is this an error by default when it's md- prefix which causes compatibility issues and not the mat- one ?
It should work out of the box.
And docs should be clear about all of this. Currently docs say to import MatXModule but to then use <md-x> element. I think I'm not the only confused by this.
Yeah I was stumped by this too, I thought from reading the changelog that the compatibility mode had been removed completely so I was surprised to see that the suggested refactor actually violates the "default" compatibility mode settings and that I had to _enable_ compatibility mode (for the first time, and in all my unit tests etc) to get it working. I was also surprised that the handy tool didn't add the provider itself.
I also think that the error message The "mat-" prefix cannot be used in ng-material v1 compatibility mode. is very unintuitive as it suggests that using mat- is invalid in compatibility mode, when in fact the opposite is true: _only_ mat- can be used in compatibility mode. You can see the issue in the compatiblility source code - the X prefix cannot be used in compatibility mode error message is thrown regardless of whether it is enabled.
Yeah, we should have updated the errors; that was an oversight
It is indeed very confusing. I would expect that after using the prefix updater tool, no errors should be reported without taking any further action.
However after using the tool I got The "mat-" prefix cannot be used in ng-material v1 compatibility mode. error mentioned above, which suggests that I had "v1 compatibility mode" on despite not opting it to use it.
On the other hand in order to get rid of the error, I had to add NoConflictStyleCompatibilityMode module dependency to my app module and all unit tests which suggest that "v1 compatibility mode" was actually off, unless the intended role of NoConflictStyleCompatibilityMode module it to opt out of "v1 compatibility mode".
This definitely needs a clarification.
@jelbourn sorry but this is till unclear for me... using beta.11 we can still use both md and mat right?
"The "md" prefixes will be removed in the next beta release" = beta.12?
@mackelito Yes I believe the md prefixes are deprecated but still supported in beta 11.
I blame my kids for not enough sleep.. of course it's still supported! 馃榿
Fixed in beta 12, no more compatibility mode required.
So, just to be clear about this... I'm currently on beta 10 and I have followed the (for example) cdk-table/mat-table example. Works functionally with cdk-table but doesn't style correctly. If I try to switch to mat prefix I get compatibility mode error. If I update to beta 12 this will disappear and I should be able to use mat with inpunity or am I clutching at straws? :)
@bownie barring other breaking changes between 10 and 12, you should be able to use mat (and only mat) without the need for compatibility mode.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
Yeah I was stumped by this too, I thought from reading the changelog that the compatibility mode had been removed completely so I was surprised to see that the suggested refactor actually violates the "default" compatibility mode settings and that I had to _enable_ compatibility mode (for the first time, and in all my unit tests etc) to get it working. I was also surprised that the handy tool didn't add the provider itself.
I also think that the error message
The "mat-" prefix cannot be used in ng-material v1 compatibility mode.is very unintuitive as it suggests that usingmat-is invalid in compatibility mode, when in fact the opposite is true: _only_mat-can be used in compatibility mode. You can see the issue in the compatiblility source code - theX prefix cannot be used in compatibility modeerror message is thrown regardless of whether it is enabled.