Activating State
3 ways
$state.go("classroom");
<a ui-sref="classroom">Class Room</a>
<a href="/classroom">Class Room</a>
$state
$state.go(to, [toParams], [options]);
to - required string (state name, use ^, . for relative paths )
toParams - optional parameter object
options (optional object )
- location ('replace/true/false' default true)
- inherit // true (default)
- relative // $state.current
- notify // true (if false stateChangeStart & stateChangeSuccess not notified)
- reload // false ( if true force reload of state even parameter not changed )
Demo
$state.go("photos.detail")
// now current state is "photos.detail"
$state.go("^") // goes to state "photos"
$state.go("^.list") // goes to sibling state ("photos.list")
$state.("^.detail.comment") // goes to "photos.detail.comment"
ui-sref ( same as $state.go but used in html )
ui-sref="stateName"
ui-sref="stateName({param1: val1, param2: val2})"
Last updated
Was this helpful?