Read here: https://www.concretepage.com/angular-...
The canDeactivate is a property of Route interface that is assigned with an array of CanDeactivateFn instances. CanDeactivateFn is a signature of function that performs as canDeactivate route guard. We create an injectable service to perform canDeactivate route guard.