2

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/

0

2 Answers 2

3

Didn't test, but I think you need to change your code to:

$state.go('searchScreen', { 'mode':'link', 'id': 234});
Sign up to request clarification or add additional context in comments.

1 Comment

This is what I want! Thank You sooo much! :)
1

Use it like this: $state.go('searchScreen', {mode: 'link', id: 234})

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.