Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

274
Views
How to stoPropagation in ion-tab from IONIC 3

I have an app with 4 ion-tabs like example below:

enter image description here

I would like that in some cases disable the ion-tab and if user try click in this disabled tabs the application will display a modal message for them. As we already know, if we disable an "ion-tab: or a "button" we cannot get the eventLister. So I'm trying to get this click event and stopPropagation() but it`s not working. Could you please help me?

take a look my code

#My ion-tabs

<ion-tabs #myTabs *ngIf="showTabs">
   <ion-tab *ngFor="let tab of tabs" [root]="tab.root" [tabTitle]="tab.title" [tabIcon]="tab.icon"
(ionSelect)="selectPage($event)" (ionChange)=selectedTab($event)></ion-tab>

#in my .ts file I tried this I get all tabs element and put a css style to simulate disabled adding a class ''.isDisabled'

const tabs = document.querySelectorAll('.tab-button');

for (let i = 1; i < tabs.length; i++) {
   tabs[i].classList.add('isDisabled');
}

here I'm trying get the tab element in position 1 and get the eventLister

tabs[1].addEventListener('click', function (e) {
  e.stopPropagation();
  alert('teste');
});

I can get this eventListener but the e.stopPropagation() is not working.

any suggestion to help me? thanks. ;)

$css

  .isDisabled {
  cursor: not-allowed;
  position: relative;
  opacity: 0.5;
  text-decoration: none;
  //pointer-events: none;
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!