I recently created a small Angular web application and decided to create a Header component using the command line ng g c Header
.
https://i.sstatic.net/ZgCi0.pngI then proceeded to write a brief paragraph in the header.component.html file.
<p>header works!</p>
https://i.sstatic.net/3UYRR.png An example of the code within **header.component.ts** is shown below:
import { Component } from '@angular/core';
@Component({
selector: 'app-header',
standalone: true,
imports: [],
templateUrl: './header.component.html',
styleUrl: './header.component.scss'
})
export class HeaderComponent {
}
https://i.sstatic.net/7U98w.png In the app.component.html file, I included:
<app-header></app-header>
And also added relevant code into app.component.ts:
import { Component } from '@angular/core';
import { RouterOutlet } from '@angular/router';
@Component({
selector: 'app-root',
standalone: true,
imports: [RouterOutlet],
templateUrl: './app.component.html',
styleUrl: './app.component.scss'
})
export class AppComponent {
title = 'MyFirstProjectDeveloperAkademie1Test';
}
However, upon trying to run the application using ng serve, an error occurred.
https://i.sstatic.net/LN5AQ.png
If anyone can offer assistance with this issue, it would be greatly appreciated. Here is the specific error message encountered: https://i.sstatic.net/HW47E.png