question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prefix change : default mode and clear docs

See original GitHub issue

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 :

  • modules (MdInputModule > MatInputModule)
  • components (<md-slider> > <mat-slider>)
  • directives (mdInput > matInput)
  • I already refactored the CSS classes before

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.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:34
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

6reactions
benelliottcommented, Sep 22, 2017

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.

5reactions
rkrzewskicommented, Sep 25, 2017

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CLEAR prefix (full-screen mode) - IBM
In the Monitor window, type CL in the prefix area to on the line that displays the entry you want to remove, then...
Read more >
Change the solution publisher prefix - Dynamics 365
To change the solution publisher prefix · Go to Settings > Customizations. · Select Publishers. · If there is more than one publisher,...
Read more >
Keyboard shortcuts for Google Docs - Android
Keyboard shortcuts for Google Docs ; Superscript, Ctrl + . ; Subscript, Ctrl + , ; Clear text formatting, Ctrl + \ ;...
Read more >
Cisco IOS IPv6 Command Reference
To specify an address prefix for address assignment, use the address prefix command in interface configuration mode. To remove the address ...
Read more >
List the objects in a bucket using a prefix filter | Cloud Storage
List the objects in a Cloud Storage bucket using a prefix.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found