简体   繁体   中英

Is it possible to stop a lifecycle hook in angular2?

I would like to stop a Lifecycle Hook in angular2 when a variable gets a value of true . Is it possible?

I didn't find anything anywhere, but I think it would be very cool to do so.

尝试这个:

this.newValue = JSON.parse(JSON.stringify(this.currentValue));

What I did is to declare a flag boolean variable outside the lifecycle. Then I changed it whenever my isLoggedIn() is true and do something only if the flag variable is true .

I could not stop the lifecycle, but I simulated it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM