使用UI路由器吴点击AngularJS改变航线 [英] AngularJS change route by ng-click using ui-router

查看:123
本文介绍了使用UI路由器吴点击AngularJS改变航线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改使用route.state代替NG-点击一个链接的应用UI的SREF。

How can I change the route.state using ng-click instead of a link applying ui-sref.

我试过这样:

<button ng-click="selectDir(file.fullPath)">set</button>

$scope.selectDir = function(location) {
    options.storageLocation = location;
    $route.current = 'recorder.options';
}

但它不工作。任何想法?

But it doesn't work. Any ideas?

推荐答案

退房UI的路由器文档维基。

Check out the ui-router documentation wiki.

最好的解决办法是使用 $ state.go()。例如, $ state.go('recorder.options')

The best solution is to use $state.go(). e.g., $state.go('recorder.options')

下面是链接到文档中的特定功能:
<一href=\"https://github.com/angular-ui/ui-router/wiki/Quick-Reference#stategoto--toparams--options\">https://github.com/angular-ui/ui-router/wiki/Quick-Reference#stategoto--toparams--options

Here's the link to the specific function in the documentation: https://github.com/angular-ui/ui-router/wiki/Quick-Reference#stategoto--toparams--options

这篇关于使用UI路由器吴点击AngularJS改变航线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆