AngularJs Routing mit Parametern

Kann mir jemand erklären, wie ich kann die route zu einer Url mit Parametern?

E. g. id gerne auf ein Produkt klickst und öffnen Sie weitere Informationen von der Produkt-Id.

Mein Routing so weit ...

        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"
            });

        });

So, Indem Sie ...

<a class="btn btn-default" href="#/product/{{item.id}}">More Info</a>

Id like to be routed to product/{{id}}.html ...

Kann jemand raten, was ich bin fehlt ...

       $routeProvider.when("/product:id", {
            templateUrl: "../app/views/product.html"
        });

InformationsquelleAutor ClarkySmiverz77 | 2016-10-01

Schreibe einen Kommentar