How can I use an empty href attribute without redirection?

Is there a way to have hrefwithout redirecting back to the root in angular2? Since I have this code <a href="" (click)="modal.open()"></a>to open modal, but redirecting it back to my home page.

I know it because of routeConfig angular, but is there any way around this?

{ path: '', component: LoginComponent, pathMatch: 'full'},

Please note that if href removal is completely valid, it can be verified without checking w3c.

+4
source share
2 answers

You can use href="javascript:;"to implement hrefwithout a side effect.

+7
source

Angular ng-href href. , href attr, ng-href.

HTML W3C, Angular, (click)=... .. :) HTML .

, , , <a>, , . <a> . <button>. href.

+1

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


All Articles