有什么区别,或两者都一样吗?
$state.current.name
:
$state = {{$state.current.name}}
$stateParams = {{$stateParams}}
$state full url = {{ $state.current.url.source }}
$state.$current.name
:
$state = {{$state.$current.name}}
$stateParams = {{$stateParams}}
$state full url = {{ $state.$current.url.source }}
我在两者中都收到相同的输出。
答案 0 :(得分:2)
$state.current
是ui-router API的变量(供开发人员使用),而$state.$current
是一个“私有”对象,实时反映UI路由器的执行上下文。
$state.$current
包含$state.current
中的数据,但也包含更多内容(如状态链$state.$current.path
)。