Rehan Aziz
Rehan Aziz

Reputation: 107

grid tags not working in angular 2

I am trying to create a grid layout in my Angular 2 based application with angular material2 but as i am trying to create a structure in the "app.component.html" file, the grid tags get an error that unknown html tags. Here is the code of how i am trying to do it: app.component.html

<div class="col-md-8">
        <div class="game-area">
            <md-grid-list class="tick-tack-grid" cols="3">
                <md-grid-tile *ngFor="let block of gs.blocks; let i = index; trackBy: trackByFn" (click)="playerClick(i)"><i [class]="block.symbol == 'done' ? 'material-icons tick' : 'material-icons cross'">{{ block.symbol }}</i></md-grid-tile>
            </md-grid-list>
        </div>
    </div>

app.component.ts

import { Component } from '@angular/core';
import { Player } from './Player';
import { Box } from './Box';
import { GameService } from './game.service';
...

Upvotes: 0

Views: 68

Answers (1)

Gosha_Fighten
Gosha_Fighten

Reputation: 3858

I believe that you didn't import the MdGridListModule module in your application module. You need to do this:

import {
  MdGridListModule
} from '@angular/material';

@NgModule({

  imports: [
    MdGridListModule
  ]
})
export class AppModule {}

See the plunk (main.ts) that illustrates this.

Upvotes: 1

Related Questions