Reputation: 15
I recently created a new Angular 18 project, and I decided to use the standalone component approach. However, in my IntelliJ IDEA editor, I keep encountering the following error underlined in AppComponent.ts
AppComponent is not declared in any Angular module.
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
standalone: true,
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'test';
}
The application works fine when I run it using ng serve. However, the IntelliJ IDEA editor keeps showing the error:
AppComponent is not declared in any Angular module.
What I’ve Tried:
My Question: Is this error expected when using standalone components in Angular 17/18? If so, how can I resolve it, or is this simply a bug or misconfiguration in IntelliJ IDEA? Do I need to configure anything extra for Angular’s standalone components in IntelliJ?
Upvotes: 1
Views: 599
Reputation: 17698
You need to update your IntelliJ version, 2021.2.4
is really old. Angular standalone is a feature which was added in 2022. IDEs from 2021 have no chance of knowing about this feature and handling it properly.
Upvotes: 6