Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 1
    Invoke a function in your controller when somebody types root and use $state.go to go to the desired page. Don't forget to inject $state in your controller Commented Aug 11, 2017 at 10:41
  • My problem is how to detect in my controller when somebody goes to / Commented Aug 11, 2017 at 10:52
  • 1
    You can use $state.current.name to get the current state name. In this case it will give you 'root'. Commented Aug 11, 2017 at 11:00
  • I tried something like this in my controller, but it doesn't seem to work (I made sure that $state was injected) (function() { if ($state.current.name == 'root') { $state.go('shop'); } }); Commented Aug 11, 2017 at 11:00