Skip to content

Problem with the new typed variables and $urlRouterProvider.otherwise #1043

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
kevinrenskers opened this issue Apr 23, 2014 · 8 comments
Closed

Comments

@kevinrenskers
Copy link

I'm testing the changes introduced in #1032 but I seem to be having a hard time with the types in combination with $urlRouterProvider.otherwise.

This works: url: '/channel/{channelId:[0-9]{1,8}}',.

This doesn't: url: '/channel/{channelId:int}',, it always redirects to my 404 page. When I remove $urlRouterProvider.otherwise('/404'); then it does work.

@timkindberg
Copy link
Contributor

hmmm I wonder if it has to do with the 404 being an integer... still doesn't explain why one would work and not the other.

@nateabele
Copy link
Contributor

@timkindberg Nope, shouldn't be affected. @kevinrenskers Do you think you could put together a Plunkr for this one as well? The last one was really helpful.

@kevinrenskers
Copy link
Author

Sure, edited same plunker: http://plnkr.co/edit/6pS8Iqj9OFBZFqLfycO7?p=preview. Basically all that's added was this (like described in this issue):

  $urlRouterProvider.otherwise('/404');

  $stateProvider.state('404', {
    url: '/404',
    template: '404!'
  });

@kevinrenskers
Copy link
Author

@nateabele were you able to find anything? Was the Plunker of any help?

@nateabele
Copy link
Contributor

It was helpful. There are a couple of different issues at play, one of which is a design issue where types aren't being registered properly. Routes and states both need to be queued and constructed at runtime. So, that's taking a little extra time. Should be resolved soon. Thanks again for the testing help.

@casio
Copy link

casio commented May 10, 2014

@nateabele so, current master doesnt really allow usage of the new typed params yet?

I was trying to play around with them today - using your listItem example from urlMatcherFactory#L602-L630. But the declared type didnt seem to have any effect(decode/encode never being called, urls like /list/John/ on state changes).

Fyi. it started to work once I put the declaration object directly into the state def:

state('list', {
  url: "/list/{item:listItem}",
  params: {
    item: {
      type: {
        encode: ...,
        decode: ...,
        is: ...
        }
      }
    }
  }
}

Sorry, this is a bit off topic - let me know if I show should put it into a new ticket.

@casio
Copy link

casio commented May 12, 2014

Nevermind my comment - there's already a ticket for the type stuff not being used/usable right now. See #1048

@eddiemonge
Copy link
Contributor

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

No branches or pull requests

5 participants