Angular 18 setup

Discussão em 'Angular' iniciado por ThatGuy1234, Novembro 18, 2024.

  1. ThatGuy1234

    ThatGuy1234 Guest

    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:

    • Restarting IntelliJ and the TypeScript service.
    • Invalidating caches in IntelliJ.

    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?

    Continue reading...

Compartilhe esta Página