Collin Dutter
Collin Dutter

Reputation: 119

Angular 4 Run Code After *NgIf Complete

I'm developing an application where I need to run some code after *ngIf has completely finished removing a component from the DOM. Specifically, I need to resize a google map, but only once the component in question is completely removed from the DOM. Is this possible? Thanks!

Upvotes: 4

Views: 686

Answers (1)

alexKhymenko
alexKhymenko

Reputation: 5598

After you flip the switch to false just use setTimeout and run resize code there. For more information, check out this answer.

this.show = false;
setTimeout(() => {
     this.resizeSomething();
})

Upvotes: 3

Related Questions