2

I am creating an AngularJS application which will get content from The Guardian API. I am using routing, so when it's at "articles/:articleId", I can get the articleId parameter. In this case, "articles/123" works fine, it returns 123, but The Guardian API id's are:

technology/competition/2013/nov/01/observer-tech-monthly-student-competition

So, it doesn't recognise news/:articleId as the route anymore, instead, it skips that controller and goes back to the normal (.otherwise()) controller. Is there any way that I could get the whole things after /news, in this case, the whole parameter to be returned:

technology/competition/2013/nov/01/observer-tech-monthly-student-competition

Thanks.

Mihai Dinculescu
  • 19,743
  • 8
  • 55
  • 70
Amar Syla
  • 3,523
  • 3
  • 29
  • 69

1 Answers1

2

Angular 1.1.5 introduced *path

For example, routes like

 `/color/:color/largecode/*largecode/edit`  

will match

`/color/brown/largecode/code/with/slashs/edit` 

and extract:

color: brown
largecode: code/with/slashs

In Angular 1.3, the syntax changed to :path*

In conclusion, if you are using Angular 1.3, I imagine that you want your route to look something like this:

articles/:articleId*
Mihai Dinculescu
  • 19,743
  • 8
  • 55
  • 70