Skip to content

State does not load when integer-type query param has non-numeric value #2732

@cvn

Description

@cvn

For a state with this url pattern /?{x:int}, if you try a url like /?x=hello, the state does not load. This applies to both 0.2.18 and 1.0.0-alpha.4. In the 1.0 alpha, it logs an error message, Error: Param values not valid for state 'myState'(…).

demo plunk (1.0.0-alhpa.4): http://plnkr.co/edit/sanCjvjL1LcGRmQXlTRF?p=preview
without the iframe: http://run.plnkr.co/plunks/sanCjvjL1LcGRmQXlTRF/#/?x=hello

The effect is that if someone types in a URL incorrectly, my app just shows a blank white page. Since query parameters are optional, it's funny that a malformed one would completely block rendering. I expected the state to load and the param to be undefined.

Is this intentional? If so, is there a way to handle the error? It isn't caught by the $stateChangeError event.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions