1

What I am trying to achieve is throwing a warning modal when the user tries to navigate from the create page without saving. Our application is using UI-Router. I am trying to use UI-Router's transition service to do this. I can stop the transition and it will continue or cancel it depending in the inner functions return value (true or false). My code so far:

ngOnInit() {
    //other code here
    const context = this;
    this.router.transitionService.onStart({}, function(transition) {
      context.openWarningDialog();
      // return boolean here
    });
  }

How can I return true or false in the function depending on which button the user presses on the modal?

Tamas Koos
  • 53
  • 1
  • 3

0 Answers0