我使用angularjs1.6在我的路线,我有以下几点
when('/myview', {
templateUrl: 'mc/templates/myview.html',
controller: 'myviewController'
}).
otherwise({
redirectTo: '/defaultView'
});当我使用搜索参数访问myview时,它将加载myview视图
/myview?foo=bar不过,当我试图重定向到这个视图时
$location.path(' /myview?foo=bar');不工作,并加载defaultView。
如何使用搜索参数在视图上重定向?
发布于 2017-12-12 13:37:11
你应该用
$state.go("myview", { foo: 'bar' });或使用位置使用.search
$location.path('/myview').search('foo', 'bar')发布于 2017-12-12 13:37:20
尝尝这个
$location.path('/myview').search('foo', 'bar')https://stackoverflow.com/questions/47773926
复制相似问题