I have category array. there are more category. I need show categories in home page as a list. I attached some screen shot below this question. What is the wrong in this code.
catlist.js
app.factory('category', ['$http', function($http) {
return $http.get('http://localhost/youtubewebservice/shop-categorylist-product.php')
.success(function(data) {
return data;
})
.error(function(err) {
return err;
});
}]);
controller.js
angular.module('starter.controllers', ['ngCordova','ngRoute'])
.controller('HomeController', ['$scope', function($scope) {
category.success(function(data) {
$scope.userslists = data;
});
$scope.minusOne = function(index) {
$scope.products[index].dislikes += 1;
};
}])
home.html
<ion-view>
<div class="bar bar-header bar-dark" style="margin-top: initial;height: 55px;">
<h1 class="title" style="margin-top: 10px;">FREE SHOPPING</h1>
<div side="left" style="margin-top: 12px;">
<button class="button button-icon button-clear ion-navicon" menu-toggle="left">
</button>
</div>
</div>
<ion-content scroll="true" has-bouncing="false" class="has-header nk-colorGrey">
<div class="bodyback" ng-repeat="cat in category">
<ion-item class="item widget uib_w_109 d-margins item-button-right" data-uib="ionic/list_item_button" data-ver="0"> {{ cat.name }} <br>
<label style="display:none;">{{ cat.term_id }}</label>
</ion-item>
</div>
</ion-content>
<div class="upage-outer fixed-header-footer">
<div class="upage-content ac0 content-area vertical-col left"></div>
</div>
categorylist-product.json
{
"category": [{
"term_id": "10",
"name": "Arden Grange",
"slug": "arden-grange",
"products": [{
"ID": "47",
"post_title": "Arden Grange, Premium",
"post_date": "2015-10-20 16:13:04",
"post_author": "5"
}, {
"ID": "50",
"post_title": "Arden Grange Puppy\/Junior Large Breed",
"post_date": "2015-10-21 04:56:23",
"post_author": "5"
}, {
"ID": "53",
"post_title": "Arden Grange Weaning\/Puppy",
"post_date": "2015-10-22 12:52:35",
"post_author": "5"
}]
}, {
"term_id": "8",
"name": "Menu 1",
"slug": "menu-1",
"products": [{
"ID": "38",
"post_title": "Home",
"post_date": "2015-10-20 10:43:44",
"post_author": "1"
}, {
"ID": "30",
"post_title": "",
"post_date": "2015-10-20 10:13:56",
"post_author": "1"
}, {
"ID": "31",
"post_title": "",
"post_date": "2015-10-20 10:13:57",
"post_author": "1"
}]
}]
}