RESTful路由提供程序

RESTful路由提供程序,rest,angularjs,route-provider,Rest,Angularjs,Route Provider,我想这样做: $routeProvider .when '/playlists/:playlistId', templateUrl: '/partials/playlists/show.html' .when '/playlists/new', templateUrl: '/partials/playlists/new.html' 不幸的是,angular似乎认为“new”是一个:playlid 关于如何实现这一点有什么建议吗?尝试更改路由的位置,并将te

我想这样做:

$routeProvider 
   .when '/playlists/:playlistId',
      templateUrl: '/partials/playlists/show.html'
   .when '/playlists/new',
      templateUrl: '/partials/playlists/new.html'
不幸的是,angular似乎认为“new”是一个:playlid


关于如何实现这一点有什么建议吗?

尝试更改路由的位置,并将templateUrl包装到params对象中:

$routeProvider 
  .when '/playlists/new',
     {templateUrl: '/partials/playlists/new.html'}
  .when '/playlists/:playlistId',
     {templateUrl: '/partials/playlists/show.html'}
我不确定解决方案是最终的,但我认为它会起作用,因为angular会按顺序解析路由
顺便说一句,我认为最好为这两个动作(新动作和播放ID)使用两个单独的控制器。

我在使用coffeescript时,templateUrl bc周围没有括号,顺序有帮助。