Skip to content

Typed parameters don't seem to get used, and states using typed parameters don't load properly #1048

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
jsdw opened this issue Apr 28, 2014 · 8 comments
Assignees
Labels
Milestone

Comments

@jsdw
Copy link

jsdw commented Apr 28, 2014

Hello,

I just built the latest version to have a play with typed parameters, which sound extremely useful!

Even using one of the pre-supplied types such as "bool", or creating my own full of console.log's, I don't see anything to indicate that the type is actually being used.

The plunker below illustrates this issue; clicking the button should set the url to #/test/0 as per how the built in "bool" type seems to work, but does not. I have also tried to create my own custom type, but it seems to have no effect.

http://plnkr.co/edit/wDB7CZb9iTdl9h7iP9lB

Am I being silly and doing something wrong or has a recent commit broke something?

Thanks in advance,
keep up the awesome work!

@jsdw
Copy link
Author

jsdw commented Apr 28, 2014

Another observation is that routing does not seem to work properly with typed parameters based on the above plunker.

click the "do it" link to navigate to the "test" state, and then right click and go back (the back event needs triggering in the app iframe, not the plunker site itself). This works fine, and takes you back to the "home" state. Now right click and go forwards. The URL changes, but the state does not.

This does not seem to happen when typed parameters are not used.

@jsdw jsdw changed the title Typed parameters don't seem to work with the current build? Typed parameters don't seem to get used, and statess using typed parameters don't load properly Apr 28, 2014
@jsdw jsdw changed the title Typed parameters don't seem to get used, and statess using typed parameters don't load properly Typed parameters don't seem to get used, and states using typed parameters don't load properly Apr 28, 2014
@nateabele
Copy link
Contributor

Yup, I'm investigating this. It's going to require queuing some configuration until runtime, so it might take a bit. Thanks for the report.

@casio
Copy link

casio commented May 12, 2014

Was also trying to experiment with the typed params.

FWIW here's the above plunk, showing a custom type in the state def kinda working: http://plnkr.co/edit/A185Dg

A bit strange seems that the default types get registered only when usercode injects $urlMatcherFactory?

@jbpros
Copy link

jbpros commented Jul 11, 2014

I did some debugging and I think this is due to the delay caused by the type queue. The types are flushed (i.e. registered?) asynchronously, when urlMatcherFactory is injected. The thing is - at least on my app - this factory is never injected anywhere and the type queue is simply ignored.

I tried injecting it into an angular.module(...).run() call but that's too late; the router has already done its job didn't see the custom type.

Is there any other place this injection should be done so that it flushes the queue before the routing processing starts?

@jbpros
Copy link

jbpros commented Jul 11, 2014

Setting enqueue to false temporarily fixed the problem. The drawback is I can't use an injectable function for the type and I had to use a simple object.

@wattsbn
Copy link

wattsbn commented Aug 12, 2014

So, is there any news on getting typed parameters to work? This feature is exactly what I need right now, but I haven't been able to figure out how to get it to work correctly. Is there a branch that has it working? Is somebody still working on the fix?

@lukashinsch
Copy link

+1

@christopherthielen
Copy link
Contributor

Fixed in 0.2.12. More Type/param fixes coming in 0.2.13, which is imminent.

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

No branches or pull requests

7 participants