Issue
Is there a way to have href
without being redirect back to the root in angular2? As I have this <a href="" (click)="modal.open()"></a>
code to open up a modal but its redirecting me back to my home page.
I know its because of the routeConfig angular has, but is there a way to say bypass that?
{ path: '', component: LoginComponent, pathMatch: 'full'},
Note sure if removing href completely is valid, it may be without check w3c validation.
Solution
You can use:
<a href="javascript:;"">Link</a>
or maybe better if you don't want to use inline JavaScript:
<a href="" (click)="$event.preventDefault()">Link</a>
to realize a Link without any side-effect.
Answered By - muetzerich
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.