Skip to content

Problem with update params #2472

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ccrisrober opened this issue Jan 20, 2016 · 3 comments
Closed

Problem with update params #2472

ccrisrober opened this issue Jan 20, 2016 · 3 comments

Comments

@ccrisrober
Copy link

Hi.
I´m trying to update one param of my state url.
The problem comes in that the content of this parameter is only obtained through a service call

I have this state definitions:

.state("post", {
    url: "post/:post_id"
    ...
})

and

.state("post_", {
   url: "post/:post_id/:post_title"
})

I need to go for the one state for the second without stack in window.history.and with url replace..

I´m trying with this code:

var info = {post_id: post.data.id, post_name: post.data.name.replace(/\s+/g, '')};
    $state.transitionTo('postd_', info, {notify: false});

Thank you

@Etheryte
Copy link

Don't use notify: false, see #1758 instead. Also, the state name is wrong in your transitionTo call. All in all this seems more appropriate for Stack Overflow than an issue on Git.

@christopherthielen
Copy link
Contributor

It's hard to understand what you mean, but I think you want to transition from post state to post_ state, update the url, and not have a new history entry.

Try using location: 'replace' as a transition option.

location - {boolean=true|string=} - If true will update the url in the location bar, if false will not. If string, must be "replace", which will update url and also replace last history record.

@christopherthielen
Copy link
Contributor

http://bit.ly/UIR-SOF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants