AngularJS更改位置

AngularJS更改位置,angularjs,Angularjs,我想自己调用带有参数的路由 我找到了可以使用的$location.search-函数,但它不适用于我的配置: $location.search('/students', {id:id}); $location.path('/students').search({id:id}); 两者都不起作用。假设您的路线定义为: '/students/:id' 然后,您需要通过以下方式设置位置路径: $location.path('/students/' + id);

我想自己调用带有参数的路由

我找到了可以使用的$location.search-函数,但它不适用于我的配置:

$location.search('/students', {id:id});
$location.path('/students').search({id:id});

两者都不起作用。

假设您的路线定义为:

'/students/:id'
然后,您需要通过以下方式设置位置路径:

$location.path('/students/' + id);