Why when I'm using `*ngIf` and `*ngFor` on same element, `*ngFor` add null item to array which I'm iterating? [duplicate]

1
Leave a Reply

avatar
1 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
Jason Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Jason
Guest

try using this if you are using below beta 8, because angular2 does’t support *ngIf anf *ngFor on same element beta 8(see here ) and below –

<template [ngIf]='hotel.rooms.length > 0'>
 <div *ngFor='#room of hotel.rooms; #i=index'>
 ... Your code
 </div>
</template>

Hope it helps you, if not provide your code as plnkr ill help you.