Sudarvizhi J

Sudarvizhi J

  • NA
  • 101
  • 23.8k

Asp.net MVC with angularjs - nested repeater

Nov 8 2017 4:27 AM
we have to implement nested ng-repeat in asp.net mvc with angularjs below code we have used its not working.
we want grouping content category based product listing. please anyone help ASAP. Below code we have used
Expected output:
Category1
Product1 catg1
Product2 catg1
Category2
Product1 catg2
Product2 catg2
index.cshtml file:
<div data-ng-repeat="catg in Categorys">
{{catg.ecom_category_title}}
<ul data-ng-repeat="prd in Products">
<li>{{prd.ecom_product_title}}</li>
</ul>
</div>
category.js file:
$http.get('/api/Category/ListAllCategory', { params: {} }).success(function (data) {
$scope.Categorys = data;
for (var i = 0; i < $scope.Categorys.length; i++) {
$scope.getCategoryID = $scope.Categorys[i].ecom_category_id;
$http.get('/api/Product/ListAllProductByCategory', { params: { ecom_category_id: $scope.getCategoryID } }).success(function (response) {
alert('dsfsdf');
$scope.Products = response;
})
.error(function () {
$scope.error = "Some Error.";
});
}
})
.error(function () {
$scope.error = "Some Error.";
});

Answers (2)