1

For my app I need to force update the *ngFor component.

Any way to force update it from my code for example with a updateList function?

I'm using a firebasepipe to get the child_added event to update the ngfor. I need to remove an entry and add an entry at the same time but it only updates things that get added.

<li *ngFor="#quote of firebaseUrl | firebaseevent:'child_added'"> <strong>"{{quote.text}}"</strong> </li>
Anne Douwe
  • 681
  • 1
  • 5
  • 19
  • What do you mean by force update? The ngFor block is updated when adding and removing elements... Do you want to update when updating the content of a particular element? – Thierry Templier Feb 21 '16 at 15:05
  • @ThierryTemplier I want to update it from an FireBase link, I used the https://github.com/sararob/angular2base and need to add and remove a entry at the same time. Now it only gets updated if something gets added. – Anne Douwe Feb 21 '16 at 15:08
  • I can't really tell without seeing a code example but it sounds like a duplicate of this http://stackoverflow.com/questions/35520018/how-to-trigger-change-detection-in-angular2 – toskv Feb 21 '16 at 15:13
  • `
  • "{{quote.text}}"
  • ` – Anne Douwe Feb 21 '16 at 15:14
  • isn't the child_added filter making it so you only get the child_added event? and not the child_removed? – toskv Feb 21 '16 at 15:17
  • Uhm, well I think so. But I don't know how to make a child_removed pipe :( – Anne Douwe Feb 21 '16 at 15:17
  • firebaseevent:'child_added':'child_removed' ? – toskv Feb 21 '16 at 15:18
  • Uhm, I'll post the pipe: – Anne Douwe Feb 21 '16 at 15:19
  • 1
    Looking at the pipe implementation here it sounds like the thing to do https://github.com/sararob/angular2base/blob/master/src/firebasepipe.ts – toskv Feb 21 '16 at 15:19
  • 1
    Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/104099/discussion-between-toskv-and-anned20). – toskv Feb 21 '16 at 15:20