Shrujan Shetty
Shrujan Shetty

Reputation: 2392

Conditional Routing in Angular + Ionic template

I am currently new to Angular Ionic Framework.

I have a screen where the user can see a list of items, where in he can tap on the item and view the details of the item on the screen. However there are certain items in the list which have multiple sub items in them. On tap of those items the user has to be redirected to a different screen which will display the sub list of items

enter image description here

Here in the above image the rows with yellow color have sub items in them, which should redirect the user to a screen A and the other item should redirect the user to screen B.

Questions 1. Is there a way to add ng-if="alarm.status == 1" ng-href=" URL TO BE ADDED HERE " else ng-href=" URL TO BE ADDED HERE " in ion-list directly or something similar?

Eg.

<ion-list >    
      <ion-item class="item-icon-right " ng-repeat="alarm in alarmList| filter: alarmName" type="item-text-wrap" ng-if="alarm.status == 1" ng-href=" URL TO BE ADDED HERE " else ng-href=" URL TO BE ADDED HERE " on-swipe-right="swipeRight()" on-swipe-left="acknoledge()" can-swipe="true">


        ....... 

      </ion-item>
    </ion-list>

Upvotes: 0

Views: 2265

Answers (1)

Joao Leal
Joao Leal

Reputation: 5542

You can do this:

ng-href="{{ alarm.status == 1? oneURL : otherURL  }}"

Upvotes: 5

Related Questions