AngularJS路由参数

时间:2015-03-16 11:05:50

标签: javascript angularjs angularjs-routing

friendID = 1234;

$route.when(
    "/friends/:friendID/raw",
    {
        event: "friends.view"
    }
);

当我在Chrome开发工具中运行上述网址时,显示所尝试的网址为http://domain.com/friends/raw?0=1&1=2&2=3&3=4

有没有办法让它以http://domain.com/friends/1234/raw

的形式运行

1 个答案:

答案 0 :(得分:0)

仅使用此片段很难分辨出这里发生了什么。你可以发布你的JSON对象的值吗?乍一看,您的对象似乎传递了多个值。您可以尝试将其值设置为1234并查看它是否正确传递。