UI Deploy

Curated, Short, Web UI Dev we Love.

Asking The User To Confirm Location Or Route Changes In AngularJS

The other day, Ward Bell and I were discussing both the future and existing routing features in AngularJS. In that conversation, we talked about what was and wasn't an appropriate responsibility for a routing module. In my opinion, the router itself shouldn't know when it's safe to navigate away from the current location; to me, that logic belongs in the Controller(s) that both understand and manage the current view-model. The controllers can hook into the $location (or $route) events and then examine the view-model in order to determine if the user should be prompted for location-change approval.

view source

Advertisement