dotJEM / angular-routing

Enhanced state based routing for Angular applications!
https://dotjem.github.io/angular-routing/
MIT License
75 stars 9 forks source link

In v0.6.2 $state.goto() params only reflected in location if a query string is already present #104

Closed groner closed 10 years ago

groner commented 10 years ago

I have an index view with filters that are applied using $state.goto() and the search is executed when $stateUpdate is observed. This much works pretty well, but the params are only applied to $location if a query string is already present. If the location has no query string, then the params are not reflected in the location.

jeme commented 10 years ago

I am not sure I understand what you are describing. Is it possible for you to create a plunkr? or provide the basic parts of your stat configuration?

You can use the template provided at: http://dotjem.github.io/angular-routing/ To quickly start a plunkr.

groner commented 10 years ago

Ok, here is a demonstration: http://plnkr.co/edit/ixXq4iNJzVdXVU2XRTVb

Enabling reloadOnSearch: false is causing the state to not load at all. I saw that behavior in my app with v0.6.1, but it started working with v0.6.2. I'll see if I can figure out what the difference is, but I guess that's a separate issue.

If you click on the "Items" tab, you will see a list of items with a search field. The search is applied by ng-submit (hit enter) or ng-blur. Searches are routed through $state, so we get a useful history.

In v0.6.2 the parameters no longer appear in the url, unless the url already contains a query string. I've provided a "[q=j]" link that has a query string.

On Fri, May 30, 2014 at 12:47 PM, Jens Melgaard notifications@github.com wrote:

I am not sure I understand what you are describing. Is it possible for you to create a plunkr? or provide the basic parts of your stat configuration?

You can use the template provided at: http://dotjem.github.io/angular-routing/ To quickly start a plunkr.

— Reply to this email directly or view it on GitHub https://github.com/dotJEM/angular-routing/issues/104#issuecomment-44672726 .

groner commented 10 years ago

It seems reloadOnSearch: false routes/states aren't loading in Firefox. I'll open another issue about that.

I've uncommented the reloadOnSearch: false in my plunk.

jeme commented 10 years ago

Pointing at the head now: http://plnkr.co/edit/rou4LVq9ccLLpBs2c0Le?p=preview Things seem to be in order.

Please reopen this issue if you have more findings. Thanks.

groner commented 10 years ago

@jeme Thanks. This seems to have fixed reloadOnSearch: false, but the state parameters are still missing from window.location when there is no query string.

Please try the following test procedure:

Open the preview in a separate window so the location bar is visible

Click on the Items link

The url should end with /items.

Type a into the search box and hit enter

The url should end with /items?q=a, but it does not.

If you clicked on the q=j link instead of the Items link, then this step does update the url.

BTW, I'm not able to reopen this issue.

jeme commented 10 years ago

Ok, that seems to be in order by switching the pipeline steps for raiseUpdate and updateRoute around.

jeme commented 10 years ago

for reference: https://github.com/dotJEM/angular-routing/commit/bdeea8cb4e160e816e6688ac5fcb052fffa6f1de

groner commented 10 years ago

That appears to have done the trick. Thanks so much for your help, @jeme.

groner commented 10 years ago

@jeme Will you be making a 0.6.3 release?

jeme commented 10 years ago

That is very likely, I am in the middle of introducing a pipeline concept around transitions, so that is what is dragging it out right now.

jeme commented 10 years ago

@groner FYI there is a 0.6.3-beta.1 release now.