Reputation: 2403
I'm using Angular 1.4.8 and angular ui-router 0.2.18
My config:
$stateProvider
.state('searchScreen', {
url:'/offers/:mode?id',
templateUrl: 'offerssearch',
controller: 'SearchController as search'
})
What I want to do is to bind a function changing url with button, here is my function:
search.createLink = function () {
$state.go('searchScreen', {url:'/offers/link?id=234'});
}
and I want my URL look like this after function call:
http://localhost:8080/#/offers/link?id=234
But /offers/link?id=234
is not appear in my URL http://localhost:8080/#/offers/
Upvotes: 2
Views: 594
Reputation: 16650
Use it like this: $state.go('searchScreen', {mode: 'link', id: 234})
Upvotes: 1
Reputation: 2150
Didn't test, but I think you need to change your code to:
$state.go('searchScreen', { 'mode':'link', 'id': 234});
Upvotes: 3