У меня есть эти вложенные ng-циклы для печати некоторого свойства и использования некоторого свойства для проверки условия, но оно не работает
мой шаблон:
<ion-list>
<ng-container *ngFor = "let publisher of publisheres " >
<ng-container *ngFor = "let card of cards" >
<ion-item text-wrap *ngFor = "let Message of card.Messages" >
<ion-avatar *ngIf = "Message.User_From_Id == publisher.Publisher.ID" >
<img src="../../assets/imgs/gonna.png" >
</ion-avatar>
<div *ngIf = "Message.User_From_Id == publisher.Publisher.ID" >
<h3> {{(card)?.Contant }} </h3>
<h3> {{(publisher)?.Publisher.name}} </h3>
</div>
</ion-item>
</ng-container>
</ng-container>
</ion-list>
мой компонент:
getPub(){
this.showLoader();
this.authService.getData().then((data) => {
this.responseData = data;
console.log(this.responseData);
this.publisheres = this.responseData
this.PublishersID = this.publisheres
this.i= this.responseData.length
console.log(this.i);
this.loading.dismiss();
}, (err) => {
console.log('error');
this.loading.dismiss();
});
}
getChats(){
this.authService.getUnMessage().then((data) => {
this.responseData = data;
this.cards = this.responseData
console.log(this.cards);
}, (err) => {
console.log('error');
});
}
обратите внимание, что cards и cards.messages - это вложенные массивы, но издатели - это отдельный массив, который я использую для создания условия