I have recently developed a separate AppNavComponent
component on Stackblitz platform.
import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterOutlet } from '@angular/router';
@Component({
standalone: true,
selector: 'app-nav',
imports: [CommonModule, RouterOutlet],
template: `<router-outlet>`,
})
export class AppNavComponent {
name = 'Angular';
}
The main component imports it in the following manner:
@Component({
selector: 'my-app',
standalone: true,
imports: [CommonModule, AppNavComponent],
template: `
<h1>Hello from {{name}}!</h1>
<a target="_blank" href="https://angular.io/start">
Learn more about Angular
</a>
`,
})
However, this setup is causing an error to occur:
Cannot find module 'app-nav.component' or its corresponding type declarations.
Any suggestions on how to resolve this issue?