I need a systematic redirection to a login page when user is not authenticated. For that purpose,
beforeModel in the application route seemed to be the best option, but it seems that
beforeModel is not triggered for all transitions, unlike
willTransition, which is always called, but when the route is exited, not entered…
beforeModel is not called when changing the URL manually.
I’ve read this Gist which explains that
willTransition is always called, which I confirm, but it doesn’t explain if
beforeModel should always be called or not, and in which conditions.
Could someone explain when should
beforeModel be called ?