5 ms·
? You need a href for the browser to know where to navigate to. Just use RouterLink. It uses a native anchor tag. If you click (without Ctrl/cmd) it prevents
by paulddraper 3y ago
?
You need a href for the browser to know where to navigate to.
Just use RouterLink.
It uses a native anchor tag. If you click (without Ctrl/cmd) it prevents default and does the navigation without reload.
- jakelazaroff 3y agoWhat is RouterLink? A quick Google search turns up some Angular thing, but I don’t think anyone was talking specifically about Angular.
- whstl 3y agoGP is talking about the component/feature present in React/Vue/Angular/etc routers that allows links to behave like normal anchor links (allowing to open in another window, etc) but also use the SPA router for navigation when possible. I'm not making any argument here, just explaining. Also makeitdouble's idea would apply even to non-SPAs or to pages without javascript. For example, I might want to submit a form but in a new tab.
- paulddraper 3y agoSorry, RouterLink for Angular, NavLink for React router.