有人可以解释如何使用参数路由到Url吗?AngularJs使用参数路由
E.g. id喜欢点击产品并通过Id打开产品的更多信息。
我的路由到目前为止...
angular.module('shop', ["customFilters", "cart", "ngRoute"])
.config(function ($routeProvider){
$routeProvider.when("/complete", {
templateUrl: "../app/views/orderComplete.html"
});
$routeProvider.when("/placeorder", {
templateUrl: "../app/views/placeOrder.html"
});
$routeProvider.when("/checkout", {
templateUrl: "../app/views/checkoutSummary.html"
});
$routeProvider.when("/products", {
templateUrl: "../app/views/productList.html"
});
$routeProvider.when("/product:", {
templateUrl: "../app/views/product.html"
});
$routeProvider.otherwise({
templateUrl: "../app/views/productList.html"
});
});
所以通过点击...
<a class="btn btn-default" href="#/product/{{item.id}}">More Info</a>
Id喜欢被路由到产品/ {{ID}}。HTML ...
有人能指教一下我缺少的...
$routeProvider.when("/product:id", {
templateUrl: "../app/views/product.html"
});
使用https://github.com/angular-ui/ui-router – malix