如何更改$ routeParams参数?
我正在访问以下网址: http://bazarak.af/#!/annonser/page=1& ...
Im accessing this url: http://bazarak.af/#!/annonser/page=1&...
.when("/annonser/:query",{
templateUrl: '/views/search.php',
controller: "Search"
})
我想获取page的值,并在url和routeParams中对其进行更改。
I would like to get the value of page and change it both in the url and in the routeParams.
要获取我尝试过的页面值
To get the page value I have tried
var pageNumber = $routeParams.page;
并进行设置,我尝试过:
and to set it I have tried:
$routeParams ==> {page:5}
这些都不起作用。而且文档并没有真正帮助我。
我该怎么做?
None of this works. And the documentation is not really helping me. How can I do this?
使用$ location.path()设置新的URL路径。它也会在路线中反映出来。
您也可以只更改$ location.search来更改查询
阅读此文档
http://docs.angularjs.org/guide/dev_guide.services 。$ location
Use $location.path() to set new URL path. It will be reflected in routes as well. You can also just change $location.search to change your query Read this documentation http://docs.angularjs.org/guide/dev_guide.services.$location