dongshan4316 2016-07-08 04:44
浏览 23

Json数组细节显示在带有离子的angularjs中

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"
    }]
}]
}

enter image description here

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微带串馈天线阵列每个阵元宽度计算
    • ¥15 关于无人驾驶的航向角
    • ¥15 keil的map文件中Image component sizes各项意思
    • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
    • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
    • ¥15 划分vlan后,链路不通了?
    • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
    • ¥15 Vue3 大型图片数据拖动排序
    • ¥15 Centos / PETGEM
    • ¥15 划分vlan后不通了