1

Overall my URLs follow the standard http://sitename/something#/rounds/2 The "when" to routeProvider goes like this:

.when('/rounds/:param', {
   templateUrl:,
   label:,
})

Ok, but now I have an URL with a question mark like this: http://sitename/something#/rounds/2?add_on=2

How can I make the routerProvider "when" deal with this? This do not works:

.when('/rounds/:param:param', {
    templateUrl:,
    label:,
})

How make this kind of URL works?

jrbedard
  • 3,662
  • 5
  • 30
  • 34
Andre Maia
  • 152
  • 1
  • 16

1 Answers1

0

URL GET parameters (like add_on=2) do not affect $routeProvider url matching, so both links (with ?add_on=2 and without) will match this:

.when('/rounds/:param', {
  templateUrl: .....
})

all URL variables will be stored in $routeParams service: --

#/rounds/2

{
  "param": "2"
}

and --

#/rounds/2?add_on=2

{
  "add_on": "2",
  "param": "2"
}

plunker: http://plnkr.co/edit/QY8QBykgdpCUIpxQC35m

Andriy
  • 14,781
  • 4
  • 46
  • 50