以下是我想要的结果
1.let suppose i have only one record then it should take "col-lg-12"
2.if i have 2 records then it should be like "col-lg-6" & "col-lg-6"
3.if i have 3 records then it should be like "col-lg-4" & "col-lg-4" & "col-lg-4".
4.if i have four record then it should be like first row of col-lg-4 each and next row will be col-lg-12
How can i do this
答案 0 :(得分:0)
我已添加此代码,请检查
export class AppComponent implements OnInit {
records=['data','data2'];
constructor(){}
ngOnInit(){}
}
你的Html文件应该是这样的
<div *ngFor="let record of records;let i=index" class="col-md-{{12/+records.length}}" >
{{record}}{{i/1}}
</div>