加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

AngularJS中$state.transitionTo()和$state.go()之间的区别

发布时间:2020-12-17 09:12:19 所属栏目:安全 来源:网络整理
导读:在AngularJS中,我看到有时我们使用$ state.transitionTo(),有时我们使用$ state.go()。任何人都可以告诉我他们有什么不同,什么时候应该使用另一个? 你是指 AngularUI Router吗?如果是这样,wiki specifies the differences: $state.go(to [,toParams]
在AngularJS中,我看到有时我们使用$ state.transitionTo(),有时我们使用$ state.go()。任何人都可以告诉我他们有什么不同,什么时候应该使用另一个?
你是指 AngularUI Router吗?如果是这样,wiki specifies the differences:

$state.go(to [,toParams] [,options])

Returns a Promise representing the state of the transition.

Convenience method for transitioning to a new state. $state.go calls $state.transitionTo internally but automatically sets options to { location: true,inherit: true,relative: $state.$current,notify: true }. This allows you to easily use an absolute or relative to path and specify only the parameters you’d like to update (while letting unspecified parameters inherit from the current state).


$state.transitionTo(to,toParams [,options])

Returns a Promise representing the state of the transition.

Low-level method for transitioning to a new state. $state.go() uses transitionTo internally. $state.go() is recommended in most situations.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读