How to $state.go()

What would always work is the full state definition: In doc there are defined these options, but they depend on CURRENT state: to stringAbsolute state name or relative state path. Some examples: $state.go(‘contact.detail’) – will go to the contact.detail state $state.go(‘^’) – will go to a parent state $state.go(‘^.sibling’) – will go to a sibling state $state.go(‘.child.grandchild’) … Read more

How to pass parameters using ui-sref in ui-router to controller

I’ve created an example to show how to. Updated state definition would be: And this would be the controller: What we can see is that the state home now has url defined as: which means, that the params in url are expected as These two links will correctly pass arguments into the controller: Also, the controller does consume $stateParams instead of $stateParam. … Read more

how to refresh page in angular 2

I have created one router link as below. This router link loads ProductsStartComponent and then this component loads several other components using ngif and not via navigation. Since below Product categories link is visible in all pages so if I am clicking on this link after reaching to some component of ngif , this is … Read more

`ui-router` $stateParams vs. $state.params

The documentation reiterates your findings here: https://github.com/angular-ui/ui-router/wiki/URL-Routing#stateparams-service If my memory serves, $stateParams was introduced later than the original $state.params, and seems to be a simple helper injector to avoid continuously writing $state.params. I doubt there are any best practice guidelines, but context wins out for me. If you simply want access to the params received into the url, then use $stateParams. … Read more

Angular-ui-router: ui-sref-active and nested states

Instead of this- You can do this- Currently it doesn’t work. There is a discussion going on here (https://github.com/angular-ui/ui-router/pull/927) And, it will be added soon. UPDATE: For this to work, $state should be available in view. More Info UPDATE [2]: As of version 0.2.11, it works out of the box. Please check the related issue: https://github.com/angular-ui/ui-router/issues/818