Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Template parse errors: 'md-grid-tile' is not a known element

I use Material Design in new Angular 2. I connected this to app.module like as:

import {MdButtonModule, MdCheckboxModule} from '@angular/material';
import {MdGridListModule, MdCardModule} from '@angular/material';

@NgModule({
  imports: [
MdButtonModule,
    MdCheckboxModule,
    MdGridListModule,
    MdCardModule
  ],

When page is loaded I get errors in console:

VM1967 vendor.bundle.js:63286 Uncaught Error: Template parse errors:
'md-grid-tile' is not a known element:
1. If 'md-grid-tile' is an Angular component, then verify that it is part of this module.
2. If 'md-grid-tile' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
    <md-grid-list cols="7" rowHeight="2" id="weekly_schedule">

How to fix? I tried any ways.

Full file is with connected material(now it dont give any errors but page is loaded unlimite in browser)

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { TranslateModule } from '@ngx-translate/core';

import { CoreModule } from '../core/core.module';
import { SharedModule } from '../shared/shared.module';
import { HomeRoutingModule } from './home-routing.module';
import { HomeComponent } from './home.component';
import { QuoteService } from './quote.service';

import { BrowserModule } from '@angular/platform-browser';
import {MdButtonModule, MdCheckboxModule} from '@angular/material';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import {MdGridListModule, MdCardModule} from '@angular/material';

@NgModule({
  imports: [
    BrowserAnimationsModule,
    BrowserModule,
    CommonModule,
    TranslateModule,
    CoreModule,
    SharedModule,
    HomeRoutingModule,
    MdGridListModule
  ],
  declarations: [
    HomeComponent
  ],
  providers: [
    QuoteService
  ]
})
export class HomeModule { }
like image 262
Daniel Avatar asked Aug 04 '17 19:08

Daniel


2 Answers

MaterialModule is removed as of 2.0.beta-11 as seen in the changelog, so you have to use mat instead of md. But still changes are going on so you need to track on git hub

like image 93
Neo Ravi Avatar answered Nov 14 '22 20:11

Neo Ravi


Replace MGridListModule to MatGridListModule,also do import as import { MatGridListModule } from '@angular/material';

you will be good to go..

like image 44
Saurav Avatar answered Nov 14 '22 20:11

Saurav