angular.js - Using two templates in Ionic list
PHPz
PHPz 2017-05-15 17:05:41
0
2
538

The project is a news category, and the list contains two forms (mixed), one is in pure title form, and the other is in picture form (three pictures are displayed side by side). The data returned by the background has a field to identify the presentation form. How to distinguish and display it in ionic. The currently used <ion-item ng-repeat="item in items"> is stuck, please give me some advice.

How to use different templates according to the background during repeat?

PHPz
PHPz

学习是最好的投资!

reply all(2)
小葫芦
<p ng-if="items[0].type==1">
    <ion-item ng-repeat="item in items">...
</p>
<p ng-if="items[0].type==2">
    <ion-item ng-repeat="item in items">...
</p>
世界只因有你
<ion-item ng-repeat="item in items">
    <p ng-if="items[0].type==1">
        {{items[0].title}}
    </p>
    <p ng-if="items[0].type==2">
        {{items[0].img}}
    </p>
</ion-item>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template