19,991 views 5,692 downloads 31 Dec 2014 History
4.9 avg · 4 ratings

UI-Router Directives

ui-sref="st­ate.name({ stateP­aram: value })"
ui-sre­f-a­ctive="ac­tiv­eCl­ass­"
Applies the class if nearest ui-sref or a descendant state is active
Applies the class if nearest ui-sref state is active
ui-view="vi­ewN­ame­"
<ui­-view autoscroll="co­ndi­tio­n">
Scroll into view on load

UI-Router Filters

string | isState
alias for $state.is('st­ate­Nam­e')
string | includ­edB­yState
alias for $state.in­cludes('st­ate­Nam­e')

UI-Router Events

$state­Cha­nge­Success
Fired after completion
$state­Cha­nge­Error
Fired on state resolution error USEFUL FOR DEBUGGING
$state­Cha­nge­Start
$state­Not­Found
$viewC­ont­ent­Loading
$viewC­ont­ent­Loaded

UI-Router Services

$state
$state­Params
contains current url params (tokens) as properties
$state­Pro­vider
config only
$urlRo­ute­rPr­ovider
config only

$state Service

alias for transi­tio­nTo()
‘conta­ct.d­et­ail­': go to ‘conta­ct.d­et­ail­'. ‘^’: go to parent. ‘^.sib­ling’: go to sibling. ‘.chil­d.g­ran­dchild’: go to current state's [grand­]child.
Force reload current state tree
Specifies if passed state is currently active (ancestry)
Specifies if passed state is current (exact)
Returns specified state or all states
The current state object

State Definition Object

url {string}
Url's are appended to parent states. Create tokens using "/:token" or using RegEx "/{token:[a-zA-Z0-9]}"
template {strin­g|f­unc­tion}
String containing template HTML or injectable function that returns the string value. (ignored if using views option)
templa­teUrl {strin­g|f­unc­tion}
String containing path to HTML file or injectable function that returns the string value. (ignored if using views option)
controller {strin­g|f­unc­tion}
String name of controller or the controller function (ignored if using views option)
abstract {boole­an[­false]}
If you can $state.go() to this view directly
onEnter {function}
Resolved dependency injectable function. Can't access $scope
onExit {function}
Resolved dependency injectable function. Can't access $scope
reload­OnS­earch {boole­an[­true]}
if false will not retrigger the same state when a query (search) parameter has changed.
params {array}
parameter names or regular expres­sions when no url is present.
views {object}
controller and templates for specific views
data {object}
stores static config­uration data
resolve {object}
Creates injectable resources: { resour­ceName: functi­on(­dep­end­enc­ies){ return promise | data; }

Badges

Good Cheat Sheet Nice Cheat Sheet Appreciated Cheat Sheet Downloaded from Unusual Locations × 4

Comments

No comments yet.

Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.