How can I change the route.state using ng-click instead of a link applying ui-sref.
如何使用ng-click而不是应用ui-sref的链接更改route.state。
I've tried this:
我试过这个:
<button ng-click="selectDir(file.fullPath)">set</button>
with
同
$scope.selectDir = function(location) {
options.storageLocation = location;
$route.current = 'recorder.options';
}
But it doesn't work. Any ideas?
但它不起作用。有任何想法吗?
1 个解决方案
#1
37
Check out the ui-router documentation wiki.
查看ui-router文档wiki。
The best solution is to use $state.go()
. e.g., $state.go('recorder.options')
最好的解决方案是使用$ state.go()。例如,$ state.go('recorder.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
以下是文档中特定功能的链接:https://github.com/angular-ui/ui-router/wiki/Quick-Reference#stategoto--toparams--options
#1
37
Check out the ui-router documentation wiki.
查看ui-router文档wiki。
The best solution is to use $state.go()
. e.g., $state.go('recorder.options')
最好的解决方案是使用$ state.go()。例如,$ state.go('recorder.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
以下是文档中特定功能的链接:https://github.com/angular-ui/ui-router/wiki/Quick-Reference#stategoto--toparams--options