Skip to content

way to create optional parameter in url? #108

Closed
@legomind

Description

@legomind

I fiddled with some regex, but this is beyond me.

I need the last parameter in my state to be optional. In other words: capture it if it is there, but otherwise ignore it.

Something like:

$stateProvider
.state \user.page, {
  url: '/:username/:page?'
  template-url: '...'
  controller: [
  \$stateParams
  ($stateParams) ->
    # The page parameter should be optional.
    # This should activate on both '/legomind/dashboard' as well as '/legomind'
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions