2

The Guardian API からコンテンツを取得する AngularJS アプリケーションを作成しています。ルーティングを使用しているので、「articles/:articleId」にある場合、articleId パラメータを取得できます。この場合、「articles/123」は正常に動作し、123 を返しますが、Guardian API id は次のとおりです。

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

そのため、news/:articleId をルートとして認識しなくなり、代わりにそのコントローラーをスキップして、通常の (.otherwise()) コントローラーに戻ります。/news の後に全体を取得する方法はありますか。この場合、パラメーター全体が返されます。

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

ありがとう。

4

1 に答える 1

2

Angular 1.1.5が導入されました*path

たとえば、次のようなルート

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

一致します

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

そして抽出:

color: brown
largecode: code/with/slashs

Angular 1.3では、構文が次のように変更されました。:path*

結論として、Angular 1.3を使用している場合、ルートを次のようにする必要があると思います。

articles/:articleId*
于 2014-12-13T12:50:24.867 に答える