Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • I would suggest creating a 'clickPreventDefault' directive rather than using javascript:void(0). Something like... @Directive({ selector: '[clickPreventDefault]' }) export class ClickPreventDefaultDirective { @HostListener("click", ["$event"]) onClick($event: Event) { $event.preventDefault(); } } Commented Apr 10, 2018 at 10:22
  • Thank you @bmd , it's a more elaborate way but it works too. Another working solution is don't use herf: <a (click)="goBack()"> although this way don't pass HTML Validators. Commented Apr 12, 2018 at 8:59