有人可以解釋如何使用參數路由到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