Monday, January 8, 2018

Interfaces in CanDeactivate guards in Angular 4!

Alright, when I wrote this I could not figure out how to use the interfaces. I think I know how now, though I have not immediately tested in. If you have a .doWhatever() method in your interface the ideal dance partner to hydrate the interface is the component you are attempting to leave itself as specified in the route. The reason I have not tested it myself is because we are using an app where routes specify modules in lieu of components as suggested here. I do not think there is a way to get the interfaces working with modules in the routes. In these cases you have to loop in a service instead and have a nude/empty interface for the interface.

No comments:

Post a Comment