0

I have Principle factory that set and get user value from local storage after login. But when the user first logged in Principle factory return firstLogin = true, if the user first logged in user must update their company. Because while registering process, the application creates an empty company model and I have to update it with source and addresses information at the first login.

So, how could I prevent user to change state by clicking over URL hrefs at navigation?

P.S

I already tried to add ng-disable= 'firstLogin' but i have a lot of states of the application. Thank you.

nolines
  • 150
  • 1
  • 15

1 Answers1

2

You can use $stateChangeStart or $routeChangeStart depending whether you are using ui-router or ng-router respectively.

You can run some functions like checking for auth etc before a state/route change occurs. Please check the examples in the docs linked.

Chinni
  • 1,199
  • 1
  • 14
  • 28