How to use ngFor to display the data as matrix

前端 未结 2 1144
粉色の甜心
粉色の甜心 2021-01-03 08:11
  • Edited to put more description *

I am new on Angular2. I have use \"ngFor\" to iterate over array of objects and show them as matrix having 3 columns f

2条回答
  •  庸人自扰
    2021-01-03 08:45

    With *ngFor you can iterate over an array. If the array items are arrays, you can nest *ngFor like:

    @Component({
      selector: '...'
      template: `
    
    {{col}}
    ` }) class Component { matrix = [['a', 'b', 'c'],['d', 'e', 'f'],['g', 'h', 'i']]; }

提交回复
热议问题