【发布时间】:2020-01-20 13:43:14
【问题描述】:
weatherForecast = [
[Weather(Monday, 10C, 11:00), (Weather(Monday, 12:00)],
[Weather(Tuesday, 10C, 11:00),(Weather(Tuesday, 12:00)]
];
如果值相同,我如何每天打印一次。代码:
<ion-item>
<ion-grid>
<ion-row *ngFor="let forecast of weatherForecast; let i = index">
<ion-col *ngFor="let weatherData of forecast; let j = index">
<div *ngIf="weatherData[j].day !== forecast[j - 1].day">
{{ forecast[j].day }}
</div>
</ion-col>
<ion-col *ngFor="let weatherData of forecast; let j = index">
<div>
{{ forecast[j].temperature }}
</div>
</ion-col>
</ion-row>
</ion-grid>
</ion-item>
【问题讨论】:
-
请显示
weatherForecastjson数据 -
@AdritaSharma weatherForecast 是表格。
-
dhoe 是什么意思?
-
我建议在组件代码中过滤掉所有不需要的数据,这样就不用在模板中过滤了。
-
@IvanKashtanov 问题是数据已经被过滤但我应该如何再次重新过滤它?请举例。
标签: angular typescript ionic-framework angular-ng-if