[ ui-router ] $stateParams

setting $stateParams

1. set from URL

// If you had a url on your state of:
url: '/users/:id/details/{type}/{repeat:[0-9]+}?from&to'

// Then you navigated your browser to:
'/users/123/details//0'

// Your $stateParams object would be
{ id:'123', type:'', repeat:'0' }

// Then you navigated your browser to:
'/users/123/details/default/0?from=there&to=here'

// Your $stateParams object would be
{ id:'123', type:'default', repeat:'0', from:'there', to:'here' }

2. set from the $state.go(state, stateParams)

$state.go("whatever.state",  { id:'123', type:'', repeat:'0' })

ref : https://github.com/angular-ui/ui-router/wiki/URL-Routing#stateparams-service,

http://stackoverflow.com/questions/23081397/ui-router-stateparams-vs-state-params

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s