2016-03-31 210 views
2

我采用了棱角分明1.4.8和角度UI路由器0.2.18

我的配置:

$stateProvider  
     .state('searchScreen', { 
      url:'/offers/:mode?id', 
      templateUrl: 'offerssearch', 
      controller: 'SearchController as search' 
     }) 

我想要做的是绑定功能改变与按钮链接,这里是我的功能:

search.createLink = function() { 
    $state.go('searchScreen', {url:'/offers/link?id=234'}); 
} 

,我想我的URL看起来像这样经过函数调用:

http://localhost:8080/#/offers/link?id=234 

/offers/link?id=234没有出现在我的URL http://localhost:8080/#/offers/

回答

3

没有测试,但我认为你需要更改您的代码:

$state.go('searchScreen', { 'mode':'link', 'id': 234}); 
+0

这是我想要的是!谢谢你太多了! :) – zaqpiotr

1

使用方法如下:$state.go('searchScreen', {mode: 'link', id: 234})

相关问题