-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Allow change browser URL without reinitialize controller status #1151
Conversation
Thanks for your contribution! In order for us to be able to accept it, we ask you to sign our CLA (contributor's license agreement). CLA is important for us to be able to avoid legal troubles down the road. For individuals (a simple click-through form): For corporations (print, sign and scan+email, fax or mail): |
I am trying to understand the use case here, but I am having troubles. Could you provide a better explanation as to why you need it? |
Sure, go to http://commonjobs.apphb.com/angulardemo/employees and write something on "Búsqueda rápida" field (see changes in URL). Let me know if there is a better way to do the same. |
I have accepted the contributor agreement. |
It sounds to me like you have implemented reloadOnSearch feature here: http://docs.angularjs.org/api/ng.$routeProvider I am going to close this since I think it is already implemented, If I misunderstood, please reopen. |
Yes, it was implemented as you said, thanks. |
I need this functionality for a specific link, not a specific route. Basically I need to click on a link, the link changes the URL, but does not reload the page, does not load a new state and does not load a new controller. The only thing that changes is the URL. Then I open a modal box. Is it possible to do this using reloadOnSearch? I don't think so. |
@CMCDragonkai They do what you're talking about on this site: http://builtwith.angularjs.org/. However, I'm not exactly sure how it is implemented (I've tried messing around with their For my app, I just ended up using search params like In the StackOverflow question below, the #1 method is to use search params. Hope this helps. |
Hey, I ended using ng-router, but relying on a bug to achieve what I want. Basically I cancel the stateChange event, this seems to shortcut the process, but allows the URL to be changed without anything else. They said it was actually bug. Well in this case, it's a bug that I want. And I really want it on the paths, not query parameters, as I use query parameters for filtering the items on the page, not as page state modifiers. |
Ah, yes, I'd actually prefer to use the paths too. So how do you cancel the stateChange event? How does it compare to this answer? http://stackoverflow.com/a/12429133/1530754 |
I think the method on SO post will only work with search parameters, not paths. Whereas the state change cancelling will work on paths. I did notice it may not play well with the back button, but alas, no real need to use it. Here's how I did it: angular-ui/ui-router#317 (comment) |
Ah, interesting - I'm actually having trouble with the stateChangeStart Ryan On Mon, Sep 16, 2013 at 3:54 PM, Roger Qiu notifications@github.com wrote:
|
As long as you have registered your states with names, all states should have names. Here's the doc for the event: https://github.com/angular-ui/ui-router/wiki#state-change-events |
No description provided.