angular-ui / ui-router

The de-facto solution to flexible routing with nested views in AngularJS
http://ui-router.github.io/
MIT License
13.56k stars 3.01k forks source link

stateParams doesn't receive value if it's didn't showed in url #3677

Closed marcosdefina closed 6 years ago

marcosdefina commented 6 years ago

obj = url: '/{a}' ----metaTags: --------title: stateParams.b $stateProvider.state('newState',obj)

If I didn't put {b} in url, stateParams.b won't show up.

jegesh commented 6 years ago

This might help you

christopherthielen commented 6 years ago

If you want to pass params without including them in the URL, use the params property of a state definition:

var state = {
  name: 'foo',
  url: '/foo',
  params: { 
    myParam: null
  }
}

Now you can use $state.go('foo', { myParam: someObject }). Note that the parameter won't be retained after a full page reload (or bookmarks).

marcosdefina commented 4 years ago

Sorry for the late reply, but thank you for taking the time to see it.