Reputation:
I am having a problem with stopPropagation, I don't know how to write in html and typescript for angular. It opens the dialog but at the same time makes a propagation.
Here is my code in HTML
:
<label for="tab-two">PROJECTS
<a class="plus" (click)="opentestdialog()">+</a>
</label>
And here is my code in TypeScript
:
opentestdialog() {
this.dialog.open(TestdialogComponent);
}
Upvotes: 0
Views: 2123
Reputation: 5250
you can just
<a class="plus" (click)="$event.stopPropagation()">+</a>
Upvotes: 0
Reputation:
thank's for your time but I have found the problem. I just wrote.
<a class="plus" (click)="opentestdialog(); false">+</a>
Thank you so much, maybe it will be helpfull for someone.
Upvotes: 3
Reputation: 151
This is the HTML:
<a class="plus" ng-click="opentestdialog($event)">+</a>
This is the typescript file:
public opentestdialog(event: angular.IAngularEvent) {
event.stopPropagation();
this.dialog.open(TestdialogComponent);
}
Upvotes: 0
Reputation: 657078
(click)="$event.stopPropagation();opentestdialog()"
or
(click)="opentestdialog($event)"
opentestdialog(e) {
e.stopPropagation()
this.dialog.open(TestdialogComponent);
}
Upvotes: 2