uksz
uksz

Reputation: 18699

How to reinitialise component?

I have some component, that I would like to reinitialise, so that it can trigger its constructor.

I was trying to do this with flag on *ngIf, but it didn't reinitialized the component (investigated by adding console log to onDestroy and to constructor).

Any ideas?

Upvotes: 1

Views: 124

Answers (1)

Günter Zöchbauer
Günter Zöchbauer

Reputation: 657268

Just move the code out of the constructor to a method and call the method from the constructor and from where you want to "reinitialize".

Upvotes: 2

Related Questions