Event handlers versus router links

It's worth nothing that instead of adding an <input> element and binding its click action to a event-handler delegate method like we just did, we could've done the following:

<a [routerLink]="['/quiz/edit', quiz.Id]"

This is the same approach taken by the NavMenuComponent with the menu entries: just a plain anchor ID QueryString parameter. Both approaches will get the job done, hence we're free to use whatever we like the most.

A big advantage of the anchor/routerLink method is that everything happens on the template, arguably making it easier and faster to lay it down; conversely, the input/click method is more versatile, as the delegate method enables the developer to do virtually anything, as we'll get ...

Get ASP.NET Core 2 and Angular 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.