jazzoria jazzoria - 1 month ago 11
AngularJS Question

Listing the sub-items using ionic and angularjs

Im trying to display the car brand name and sub-list the car model names related to the car brand. But my car model names are displayed as an array and not as a list. Please help me to resolve it.

Link

<ion-list>
<ion-item ng-model="carBrand" ng-click="selectItem(carBrand)" ng-repeat="name in brandList">
<div class="item item-divider">
{{name.name}}
</div>
<div class="item">{{name.types}}</div>
</ion-item>
</ion-list>

Answer

Add ng-repeat for types as <div class="item" ng-repeat="type in name.types">{{type}}</div>

<ion-content ng-contorller="carBrand">
    <h3> Add/Edit the Car Types </h3>
    {{sample}}
    Make:
    <ion-list>
        <ion-item ng-model="carBrand" ng-click="selectItem(carBrand)" ng-repeat="name in brandList">
            <div class="item item-divider">
                {{name.name}}
            </div>
            <div class="item" ng-repeat="type in name.types">{{type}}</div>
            <br/>
        </ion-item>            
    </ion-list>         
</ion-content>