Reputation: 38352
I have been facing a lot of UI router issues (due to my own silly mistakes) and having tough time debugging it.
I have a module structure and set state form multiple files all added as dependency to app.js. Lot of times due to some error (typos, missing dependency etc) it just redirects to default route.
I am seeking suggestions on how to debug. I am not looking for a specific solution to my problem, but a general way of dealing with such issues.
Upvotes: 1
Views: 387
Reputation: 3569
Consider attaching to the State Change Events provided by ui-router, and place your breakpoints and/or console debug output within them.
The events provided (available on $rootScope
) include $stateChangeStart
, $stateChangeSuccess
, $stateChangeError
and $stateNotFound
. If you assign some handlers for these you can fairly easily inspect a lot of information about the to/from states and params, etc.
Upvotes: 1