ngFor using ngClass on rows and columns issue

后端 未结 4 1898
忘掉有多难
忘掉有多难 2020-12-15 19:07

I am using Angular2 and its ngFor. I want to add class to odd and to even rows, so I can separate them visually by color.

Here is my code (which does not work really

4条回答
  •  抹茶落季
    2020-12-15 19:35

    Your first code example is working fine Plunker example

    @Component({
      selector: 'my-app',
      styles: [`
        .even { color: red; }
        .odd { color: green; }
        `],
      template: `
      

    Hello {{name}}

    {{meeting}}
    ` }) export class App { meetingList = ['a', 'b', 'c']; }

提交回复
热议问题