简体   繁体   English

Angular + Ionic模板中的条件路由

[英]Conditional Routing in Angular + Ionic template

I am currently new to Angular Ionic Framework. 我目前是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 在点击这些项目时,用户必须被重定向到另一个屏幕,该屏幕将显示项目的子列表

在此处输入图片说明

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. 在上图中的黄色行中,其中包含子项,这些子项应将用户重定向到屏幕A,其他项应将用户重定向到屏幕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? 问题1.是否有办法在离子列表中直接添加ng-if =“ alarm.status == 1” ng-href =“此处添加URL” else ng-href =“ URL此处添加”相似的东西?

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>

你可以这样做:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM