Angular / ionic attributes are added conditionally for <ion-tab>

I want to add scroll functions conditionally using angularjs,

The controller has scope variables "customerview" and "kycview".

$scope.customerview = 'customerview';
$scope.kycview = 'kycview';

I want to remove / hide " on-swipe-right " and " on-swipe-left " if the view is "kycview"

How to write a conditional statement to turn on and off?

template

  <ion-tabs class="tabs-striped tabs-positive">
        <ion-tab id="personalDetails" title="Personal" href="#/newcustomer/PersonalDetails" class="{{persDetailsComplete}}">
            <ion-nav-view name="newcustomer-PersonalDetails"></ion-nav-view>
        </ion-tab>
        <ion-tab id="familyDetails" title="Family &amp; Housing" href="#/newcustomer/FamilyDetails" class="{{familyDetailsComplete}}" disabled="customerState != 'customerview'" on-swipe-right="goBack()" on-swipe-left="goForward()">
            <ion-nav-view name="newcustomer-FamilyDetails"></ion-nav-view>
        </ion-tab>
        <ion-tab id="idproof" title="ID Proof" href="#/newcustomer/Idproof"  class="{{idProofComplete}}" disabled="customerState != 'customerview'">
            <ion-nav-view name="newcustomer-Idproof"></ion-nav-view>
        </ion-tab>              
        <ion-tab title="Address" href="#/newcustomer/Address" ng-click="getNewAddress(3);" ng-controller="CustomerController"  class="{{addressComplete}}" disabled="customerState != 'customerview'">
            <ion-nav-view name="newcustomer-Address"></ion-nav-view>
        </ion-tab>       
        <ion-tab title="Employment" href="#/newcustomer/EmploymentDetails" class="{{employeementComplete}}" disabled="customerState != 'customerview'">
            <ion-nav-view name="newcustomer-EmploymentDetails"></ion-nav-view>
        </ion-tab>
        .................
        .................


    </ion-tabs>
+4
source share
2 answers
<ion-tab id="familyDetails" title="Family &amp; Housing" href="#/newcustomer/FamilyDetails" class="{{familyDetailsComplete}}" on-swipe-right="goBack()"  on-swipe-left="goForward()" ng-if="view=='kycview' &&customerview=='kycview'" >

<ion-tab id="familyDetails" title="Family &amp; Housing" href="#/newcustomer/FamilyDetails" class="{{familyDetailsComplete}}" on-swipe-right="goBack()" on-swipe-left="goForward()">
+1
source

I accept the scope variable as

$ scope.view = "customerview" 
or
$ scope.view = "kycview";

ion-tab id="familyDetails" title="Family & Housing" href="#/newcustomer/FamilyDetails" class="{{familyDetailsComplete}}" on-swipe-right="goBack()" on-swipe-left="goForward()" ng-if="view=='customerview'">

ion-tab id="familyDetails" title="Family & Housing" href="#/newcustomer/FamilyDetails" class="{{familyDetailsComplete}}" ng-if="view=='kycview'">
0

Source: https://habr.com/ru/post/1619464/


All Articles