2016-02-03 34 views
0

我正在使用Yeoman的angular-fullstack,并坚持基于Mongo的自动生成的_id制作多个视图。该StoreCtlr,所有数据填充到PAG,E运作良好,我只是有传入参数到StoreShowCtrl麻烦角度和mongodb中的多个视图的路由

我控制器低于:

storeControllers.controller('StoreShowCtrl', ['$scope', '$routeParams','$http', 
    function($scope, $routeParams, $http) { 
    $http.get('api/items'+$routeParams.items._id).success(function(detail) { 
     $scope.data = detail; 
    }); 
    } 
]); 

我与

路由
.when('/product/:id', { 
     templateUrl: 'app/product/product.html', 
     controller: 'StoreShowCtrl' 
}); 

谢谢你的帮助!

+0

是否显示任何错误消息? – slbteam08

回答

0

使用$ routeParams.id代替$ routeParams.items._id的控制器,因为你提到ID为PARAM而定义的状态。 这将工作。