私は shoppingCart プロジェクトに取り組んでおり、データを動的にビューに取り込みたいので、template.html で routeParams を呼び出していますが、正常に到着しているため、経由でチェックされていますが、ng-repeat では機能していません。
index.html
<a style="cursor: pointer;" ng-href="#/store/{{something.name}}/{{ child.name }}">{{ child.display_name }}</a>
app.js でのルーティング
when('/store/:Department/:Category', { templateUrl: 'partials/template.html', コントローラー: storeController })。
controller.js
function storeController($scope, $route, $routeParams, $location, DataService) { $scope.name = "storeController"; $scope.$route = $route; $scope.$location = $location; $scope.$routeParams = $routeParams; $scope.Category = $routeParams.Category; }
store.js
function store() {
this.fruits = [
new product("APL", "Apple", "Eat one every day to keep the doctor away!", 12, 90, 0, 2, 0),
new product("BAN", "Banana", "These are rich in Potassium and easy to peel.", 4, 120, 0, 2, 1)];
}
template.html
<pre>$routeParams.Category = {{$routeParams.Category}}</pre>
そうしないと、store.fruits、store.vegetablesのように呼び出す必要があり、それぞれに個別のファイルを作成する必要があります。助けてください