Angularjs $state.go()和$state.transitiono()之间的差异

Angularjs $state.go()和$state.transitiono()之间的差异,angularjs,angular-ui-router,Angularjs,Angular Ui Router,在angularjs中,如果我们想更改状态,$state.go()和$state.transitiono()这两件事甚至在教程中也被很多人提到。但我怀疑的是,有人说$state.go()是好的,也是推荐的。但如果你从外部看,这两个过程是一样的。例如$state.go('^.create')与$state.transitiono('create')相同 $stateProvider.state('create'), { url:“/create”, 模板:“”, 控制器:“xyz” }) 我想知

在angularjs中,如果我们想更改状态,$state.go()和$state.transitiono()这两件事甚至在教程中也被很多人提到。但我怀疑的是,有人说$state.go()是好的,也是推荐的。但如果你从外部看,这两个过程是一样的。例如$state.go('^.create')与$state.transitiono('create')相同

$stateProvider.state('create'),
{
url:“/create”,
模板:“”,
控制器:“xyz”
})
我想知道$state.go()和$state.transitiono()的确切区别是什么

从源头上

$state.go = function go(to, params, options) {
return this.transitionTo(to, params, extend({ inherit: true, relative: $state.$current             }, options));
  };
$state.go
只调用
transitiono
,并将inherit和relative设置为true。几乎没有区别

$state.go = function go(to, params, options) {
return this.transitionTo(to, params, extend({ inherit: true, relative: $state.$current             }, options));
  };