Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to provide information to canDeactivate in Aurelia view-model

Tags:

aurelia

I am using canDeactivate() in a view-model. There is a way for the user to navigate away from the view where canDeactivate should not do its checks and just return true (in this case, when the user presses a Back button which is in another view). It appears that canDeactivate does not take any arguments (such as the params passed to router.navigateToRoute). If it did, I could indicate that the Back button was pressed in the params arg when calling navigateToRoute. What would be a good way to give canDeactivate this needed piece of information?

like image 706
Jeff G Avatar asked Nov 08 '22 11:11

Jeff G


1 Answers

starting in aurelia-router 1.4.0, canDeactivate is passed an argument which contains the information you need to accomplish this

like image 73
Ellery Newcomer Avatar answered Dec 21 '22 14:12

Ellery Newcomer