Angular constant errors

26 views Asked by At

I am new to Angular but for some reason, I got lots of errors with simple stuff. I tried following a pretty simple guide. I created a new component and added it to app.component.html and got an error with import. Then I got another error when I tried to use a quick fix to fix it.

Now I am stuck with: "Can't bind to 'routerLink' since it isn't a known property of 'a'."

I know it's basic stuff but I begin to wonder if my Visual Studio Code is missing some extensions or if there is something with the latest angular version (mine is: Angular CLI: 17.2.3). It looks kinda weird when I follow a video where the same stuff is done from scratch but it works perfectly, while I get random errors.

1

There are 1 answers

1
Ricudo On

Just import RouterLink. This is the Angular v17 dummy component i created few days ago:

import { Component } from '@angular/core';
import { RouterLink } from '@angular/router';

@Component({
  selector: 'app-product-list',
  standalone: true,
  imports: [RouterLink],
  templateUrl: './product-list.component.html',
  styleUrl: './product-list.component.css',
})
export class ProductListComponent {}