在AngularJS中意味着什么?

时间:2015-04-10 14:19:39

标签: angularjs angular-ui-router

此AngularJS代码中'^.^''^'字符串的含义是什么?

if (isFilterState()) {
  $state.go('^.^.' + report.subtype, {id: report.id});
} else {
  $state.go('^.' + report.subtype, {id: report.id});
}

1 个答案:

答案 0 :(得分:2)

https://github.com/angular-ui/ui-router/wiki/Quick-Reference#stateproviderstatestatename-stateconfig

字符串绝对状态名称或相对状态路径

将转换到的状态的名称或相对状态路径。如果路径以^或开头。然后它是相对的,否则它是绝对的。

一些例子:

$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') will go to a grandchild state.