Substitute for ion-stop-event in ionic 3


#1

Hi all,

Is there any substitute for ion-stop-event in ionic 3.
I have case that i need nested event, like this:

<div click="viewDetail()">
  short detail in here
  <button click="delete()">Delete</button>
</div>

When i click delete, somehow viewDetail is also called.
Any directive to disable click in parent container when i click in child element.

Thanks


#2

for now, i will create a directive to stop click event only (dont know how to implement generically for other events)

import { Directive, HostListener } from '@angular/core';

@Directive({
  selector: '[ion-stop-click]'
})
export class IonStopClickDirective {

  @HostListener("click", ["$event"])
  public onClick(event: any): void
  {
    event.stopPropagation();
  }
}

any idea are welcome, may be someday anyone also need other event.

Thanks


#3

I don’t really have any other ideas, but I want to say is the best solution I’ve found so far great way of doing it! should be implemented in source code