离子侧多级菜单中的子数据无法正确显示

时间:2015-09-09 07:21:23

标签: javascript angularjs cordova ionic

根据附图,我的数据显示不正确。如何删除“[{”标题“:......”在我的侧边菜单子数据中仅保留“文具”?当我点击我的父项时,它将下拉一个子值。但它没有显示'文具',而是显示'[         {title:'文具'},         {title:'Paper& Pads'},         {title:'技术'},         {title:'Ink&碳粉'},......'

我的menu.html如下:

<div ng-repeat="item in items" ng-click="toggleGroup(items)" ng-controller="dropDownCtrl">
 <ion-item>
{{item.title}}
<i class="icon" ng-class="isGroupShown(items) ? 'ion-arrow-up-b' : 'ion-arrow-down-b'"> </i>
</ion-item>
<ion-item ng-show="isGroupShown(items)" menu-close href="#/app/home">
{{item.children}}
</ion-item>
</div>

和我的controllers.js:

starter.controller('dropDownCtrl', function( $scope ) {

$scope.items = [
{title: 'Products',
children: [
    { title: 'Stationery' },
    { title: 'Paper & Pads' },
    { title: 'Technology' },
    { title: 'Ink & Toner' },
    { title: 'Pantry' ,
    children: [
        { title: 'Snacks, Beverages & Condiments' },
        { title: 'Tableware and Pantry Accessories' },
        { title: 'Cleaning Supplies' },
        { title: 'Medical Products' , 
        children: [
            { title: 'First Aids ' },
        ]}
    ]}
]
},
{title: 'My Catalogs'},
{title: 'My RFQs'},
{title: 'My Orders'}
    ];

1 个答案:

答案 0 :(得分:0)

因为您在children中引用了整个对象。将{{item.children}}更改为{{item.children.title}}