2017-05-10 2 views
1

과의 비교 날짜 ngif 나는 두 날짜를 비교해야 내가 ngif이 방법을 사용하지만 당신은 또한 당신의 구성 요소에 함수를 호출하는 *ngIf를 사용할 수는* 각 2

<ion-row *ngFor="let ch of cheval1 "> 
     {{ch[0].annee }} 
      <ion-col *ngFor="let m of members"> 
       <b *ngIf="ch[0].annee == m.Course.date |date : 'yyyy' "> {{m.Course.date |date : 'yyyy' }} </b> 
      </ion-col> 
     </ion-row> 
+1

중괄호에서 포장 시도 :'* ngIf = "CH [0] .annee == (m.Course.date | 날짜 : 'YYYY')"' – PierreDuc

+0

당신을 감사합니다 .. 그것은 –

답변

2

작동하지 않습니다 :

<ion-row *ngFor="let ch of cheval1 "> 
    {{ch[0].annee }} 
    <ion-col *ngFor="let m of members"> 
     <b *ngIf="yearsAreEqual(ch[0].annee, m.Course.date)"> {{m.Course.date |date : 'yyyy' }} </b> 
    </ion-col> 
</ion-row> 


yearsAreEqual(year, date){ 
    return year === date.getFullYear(); 
} 
+0

감사를 작동하고 너 @ 타이터 –

+0

타일러, 제발 내 문제를 도와 줄 수있어? –

+0

안녕하세요, 제발 내 문제를 도와 줄 수 있습니다 : http://stackoverflow.com/questions/43919676/calculating-sum-of-elements-by-date-in-angular-2-andionic-2-ngfor –