Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The "mat-" prefix cannot be used in ng-material v1 compatibility mode. It was used on an "mat-form-field" element. #923

Closed
megetron opened this issue Oct 8, 2017 · 18 comments

Comments

@megetron
Copy link

megetron commented Oct 8, 2017

What is the expected behaviour?

Trying to integrate covalent's aitocomplete into a project using SystemJS and getting this:

ERROR Error: Uncaught (in promise): Error: The "mat-" prefix cannot be used in ng-material v1 compatibility mode. It was used on an "mat-form-field" element.
Error: The "mat-" prefix cannot be used in ng-material v1 compatibility mode. It was used on an "mat-form-field" element.

I did not Include the core and theme styles in my scss file yet (would like to see a default behaviour on app).

Which version of Angular and Material, and which browser and OS does this issue affect?

angular 4.1.0 material 2.0.0-beta.11

Did this work in previous versions of Angular / Material?
I am just a beginner with covalent so not sure about previous versions.

@jotatoledo
Copy link
Contributor

Please use the issue template and add your locally installed versions

@megetron
Copy link
Author

megetron commented Oct 9, 2017

@jotatoledo , done.

@jotatoledo
Copy link
Contributor

jotatoledo commented Oct 9, 2017

With material beta.11 you can use covalent beta.7, and beware that with those versions you cannot use mat-* anywhere in your templates. Apparently you did that somewhere and the error was triggered

@megetron
Copy link
Author

megetron commented Oct 9, 2017

After update to a lower version "beta.7" searched all my project files for a "mat" keyword but found none..I get hard times to start using covalent components. just sending logs, do you have another guess what can go wrong here?

ERROR Error: Uncaught (in promise): Error: The "mat-" prefix cannot be used in ng-material v1 compatibility mode. It was used on an "mat-form-field" element.
Error: The "mat-" prefix cannot be used in ng-material v1 compatibility mode. It was used on an "mat-form-field" element.
    at getMdCompatibilityInvalidPrefixError (compatibility.ts:11)
    at new MatPrefixRejector (compatibility.ts:28)
    at createClass (provider.ts:365)
    at createDirectiveInstance (provider.ts:182)
    at createViewNodes (view.ts:354)
    at callViewAction (view.ts:797)
    at execComponentViewsAction (view.ts:715)
    at createViewNodes (view.ts:382)
    at callViewAction (view.ts:797)
    at execComponentViewsAction (view.ts:715)
    at getMdCompatibilityInvalidPrefixError (compatibility.ts:11)
    at new MatPrefixRejector (compatibility.ts:28)
    at createClass (provider.ts:365)
    at createDirectiveInstance (provider.ts:182)
    at createViewNodes (view.ts:354)
    at callViewAction (view.ts:797)
    at execComponentViewsAction (view.ts:715)
    at createViewNodes (view.ts:382)
    at callViewAction (view.ts:797)
    at execComponentViewsAction (view.ts:715)
    at resolvePromise (zone.js?1507590660744:824)
    at resolvePromise (zone.js?1507590660744:795)
    at zone.js?1507590660744:873
    at ZoneDelegate.invokeTask (zone.js?1507590660744:425)
    at Object.onInvokeTask (ng_zone.ts:288)
    at ZoneDelegate.invokeTask (zone.js?1507590660744:424)
    at Zone.runTask (zone.js?1507590660744:192)
    at drainMicroTaskQueue (zone.js?1507590660744:602)
    at ZoneTask.invokeTask [as invoke] (zone.js?1507590660744:503)
    at invokeTask (zone.js?1507590660744:1540)
    at ____________________Elapsed_28_ms__At__Tue_Oct_10_2017_02_11_05_GMT_0300__IDT_ ()
    at Object.onScheduleTask (long-stack-trace-zone.js?1507590660745:109)
    at ZoneDelegate.scheduleTask (zone.js?1507590660744:405)
    at Object.onScheduleTask (zone.js?1507590660744:301)
    at ZoneDelegate.scheduleTask (zone.js?1507590660744:405)
    at Zone.scheduleTask (zone.js?1507590660744:236)
    at Zone.scheduleMicroTask (zone.js?1507590660744:256)
    at scheduleResolveOrReject (zone.js?1507590660744:871)
    at resolvePromise (zone.js?1507590660744:819)
    at ____________________Elapsed_0_ms__At__Tue_Oct_10_2017_02_11_05_GMT_0300__IDT_ ()
    at Object.onScheduleTask (long-stack-trace-zone.js?1507590660745:109)
    at ZoneDelegate.scheduleTask (zone.js?1507590660744:405)
    at Object.onScheduleTask (zone.js?1507590660744:301)
    at ZoneDelegate.scheduleTask (zone.js?1507590660744:405)
    at Zone.scheduleTask (zone.js?1507590660744:236)
    at Zone.scheduleMicroTask (zone.js?1507590660744:256)
    at scheduleResolveOrReject (zone.js?1507590660744:871)
    at resolvePromise (zone.js?1507590660744:819)
    at ____________________Elapsed_2_ms__At__Tue_Oct_10_2017_02_11_05_GMT_0300__IDT_ ()
    at Object.onScheduleTask (long-stack-trace-zone.js?1507590660745:109)
    at ZoneDelegate.scheduleTask (zone.js?1507590660744:405)
    at Object.onScheduleTask (zone.js?1507590660744:301)
    at ZoneDelegate.scheduleTask (zone.js?1507590660744:405)
    at Zone.scheduleTask (zone.js?1507590660744:236)
    at Zone.scheduleMicroTask (zone.js?1507590660744:256)
    at scheduleResolveOrReject (zone.js?1507590660744:871)
    at resolvePromise (zone.js?1507590660744:819)
    at ____________________Elapsed_1_ms__At__Tue_Oct_10_2017_02_11_05_GMT_0300__IDT_ ()
    at Object.onScheduleTask (long-stack-trace-zone.js?1507590660745:109)
    at ZoneDelegate.scheduleTask (zone.js?1507590660744:405)
    at Object.onScheduleTask (zone.js?1507590660744:301)
    at ZoneDelegate.scheduleTask (zone.js?1507590660744:405)
    at Zone.scheduleTask (zone.js?1507590660744:236)
    at Zone.scheduleMicroTask (zone.js?1507590660744:256)
    at scheduleResolveOrReject (zone.js?1507590660744:871)
    at ZoneAwarePromise.then (zone.js?1507590660744:981)
    at ____________________Elapsed_70_ms__At__Tue_Oct_10_2017_02_11_04_GMT_0300__IDT_ ()
    at Object.onScheduleTask (long-stack-trace-zone.js?1507590660745:109)
    at ZoneDelegate.scheduleTask (zone.js?1507590660744:405)
    at Object.onScheduleTask (zone.js?1507590660744:301)
    at ZoneDelegate.scheduleTask (zone.js?1507590660744:405)
    at Zone.scheduleTask (zone.js?1507590660744:236)
    at Zone.scheduleMicroTask (zone.js?1507590660744:256)
    at scheduleResolveOrReject (zone.js?1507590660744:871)
    at ZoneAwarePromise.then (zone.js?1507590660744:981)
    at ____________________Elapsed_30_ms__At__Tue_Oct_10_2017_02_11_04_GMT_0300__IDT_ ()
    at Object.onScheduleTask (long-stack-trace-zone.js?1507590660745:109)
    at ZoneDelegate.scheduleTask (zone.js?1507590660744:405)
    at Object.onScheduleTask (zone.js?1507590660744:301)
    at ZoneDelegate.scheduleTask (zone.js?1507590660744:405)
    at Zone.scheduleTask (zone.js?1507590660744:236)
    at Zone.scheduleMicroTask (zone.js?1507590660744:256)
    at scheduleResolveOrReject (zone.js?1507590660744:871)
    at resolvePromise (zone.js?1507590660744:819)
    at ____________________Elapsed_0_ms__At__Tue_Oct_10_2017_02_11_04_GMT_0300__IDT_ ()
    at Object.onScheduleTask (long-stack-trace-zone.js?1507590660745:109)
    at ZoneDelegate.scheduleTask (zone.js?1507590660744:405)
    at Object.onScheduleTask (zone.js?1507590660744:301)
    at ZoneDelegate.scheduleTask (zone.js?1507590660744:405)
    at Zone.scheduleTask (zone.js?1507590660744:236)
    at Zone.scheduleMicroTask (zone.js?1507590660744:256)
    at scheduleResolveOrReject (zone.js?1507590660744:871)
    at resolvePromise (zone.js?1507590660744:819)
    at ____________________Elapsed_0_ms__At__Tue_Oct_10_2017_02_11_04_GMT_0300__IDT_ ()
    at Object.onScheduleTask (long-stack-trace-zone.js?1507590660745:109)
    at ZoneDelegate.scheduleTask (zone.js?1507590660744:405)
    at Object.onScheduleTask (zone.js?1507590660744:301)
    at ZoneDelegate.scheduleTask (zone.js?1507590660744:405)
    at Zone.scheduleTask (zone.js?1507590660744:236)
    at Zone.scheduleMicroTask (zone.js?1507590660744:256)
    at scheduleResolveOrReject (zone.js?1507590660744:871)
    at resolvePromise (zone.js?1507590660744:819)
    at ____________________Elapsed_1_ms__At__Tue_Oct_10_2017_02_11_04_GMT_0300__IDT_ ()
    at Object.onScheduleTask (long-stack-trace-zone.js?1507590660745:109)
    at ZoneDelegate.scheduleTask (zone.js?1507590660744:405)
    at Object.onScheduleTask (zone.js?1507590660744:301)
    at ZoneDelegate.scheduleTask (zone.js?1507590660744:405)
    at Zone.scheduleTask (zone.js?1507590660744:236)
    at Zone.scheduleMicroTask (zone.js?1507590660744:256)
    at scheduleResolveOrReject (zone.js?1507590660744:871)
    at ZoneAwarePromise.then (zone.js?1507590660744:981)
defaultErrorLogger @ errors.ts:42

@bourse-a
Copy link

I have same problem, do you find a solution ?

@jatkeshave
Copy link

jatkeshave commented 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';

found this when i was check for changes in source, they should mention this somewhere

@lakinmohapatra
Copy link

Covalent UI needs to be updated with latest material changes.

@jotatoledo
Copy link
Contributor

It was already updated, read the changelogs from both material and covalent

@bourse-a
Copy link

I only use mat- prefix and i still have this error, even with NoConflictStyleCompatibilityMode.
I have used angular-material-prefix-updater

@MROALI
Copy link

MROALI commented Oct 11, 2017

search your code for md- and replace it with mat- . I think there still in your code some component referenced by md-

@megetron
Copy link
Author

Thanks @jatkeshave, the NoConflictStyleCompatibilityMode thing solved the issue for me.
FYI, In my application I did a search for both "md-" and "mat-" but couldn't find any matches.

so as @MROALI suggested probably some of other external components the app imported had these prefixes.

Thanks again for you quick response! very helpful!

@jotatoledo
Copy link
Contributor

@megetron close

@emoralesb05
Copy link
Contributor

Closing this since now everything is using mat with material beta.12 and covalent beta.8-1.. so there shouldnt be any issues going forward.

NOTE: searching for md- will not find anything since there are md camel case inputs

@rijomonr
Copy link

I/m facing the same issue @angular/cli: 1.4.4 node: 6.11.2 os: win32 ia32 @angular/animations: 4.4.4 @angular/cdk: 2.0.0-beta.11 @angular/common: 4.4.4 @angular/compiler: 4.4.4 @angular/core: 4.4.4 @angular/forms: 4.4.4 @angular/http: 4.4.4 @angular/material: 2.0.0-beta.11 @angular/platform-browser: 4.4.4 @angular/platform-browser-dynamic: 4.4.4 @angular/router: 4.4.4 @angular/cli: 1.4.4 @angular/compiler-cli: 4.4.4 @angular/language-service: 4.4.4 typescript: 2.3.4

@kyleledbetter
Copy link
Contributor

Read the thread rijomonr

@bourse-a
Copy link

Thanks for your awsers. My problem was due to Md2 package.
I link issue of this package Promact/md2#290 to help others.

@MienDev
Copy link

MienDev commented Oct 13, 2017

For those who are using both md2 and material2 2.0.0 beta.12

  1. Ensure that all md selector is replaced for material2, such as mdLine, md-rise-button and so on.
  2. Import NoConflictStyleCompatibilityMode (from md2) as flowing.
@NgModule({
  imports: [
    // ... 
    Md2Module,
    NoConflictStyleCompatibilityMode  // from 'md2'
  ]
}

For more infomation, refer to
Promact/md2#290 (comment)

@etonyali
Copy link

etonyali commented Nov 15, 2017

Adding
import {NoConflictStyleCompatibilityMode} from '@angular/material';
into app.module.ts
and NoConflictStyleCompatibilityMode to imports fix the issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests