Using Pipe in No Standalone component

Discussão em 'Angular' iniciado por giolongo, Março 28, 2025.

  1. giolongo

    giolongo Guest

    I have a no standalone component with Angular 19

    import { Component, inject, OnInit } from '@angular/core';
    import { HelloWorldFacade } from './+state/hello-world.facade';
    import { Observable } from 'rxjs';
    import { CommonModule, DatePipe } from '@angular/common';

    @Component({
    selector: 'lib-hello-world-with-ngrx',
    standalone: false,
    template: `
    {{message$ | async}}
    `,
    styles: ``
    })
    export class HelloWorldWithNgrxComponent implements OnInit{

    public message$?: Observable<string>;
    private hwFacade = inject(HelloWorldFacade);


    ngOnInit(): void {
    this.message$ = this.hwFacade.message$

    setInterval(() => {
    this.hwFacade.appendMessage('a');
    }, 10000);
    }

    }


    with its module

    import { CommonModule, AsyncPipe } from '@angular/common';
    import { NgModule } from '@angular/core';
    import { EffectsModule } from '@ngrx/effects';
    import { StoreModule } from '@ngrx/store';
    import { HelloWorldEffects } from './+state/hello-world.effects';
    import { HelloWorldFacade } from './+state/hello-world.facade';
    import * as fromHW from './+state/hello-world.reducer';
    import { HelloWorldWithNgrxComponent } from './hello-world-with-ngrx.component';

    @NgModule({
    imports: [
    CommonModule,
    AsyncPipe,
    StoreModule.forFeature(
    fromHW.HW_FEATURE_KEY,
    fromHW.hwReducer
    ),
    EffectsModule.forFeature([HelloWorldEffects])
    ],
    providers: [HelloWorldFacade],
    declarations: [HelloWorldWithNgrxComponent],
    exports: [HelloWorldFacade, HelloWorldWithNgrxComponent, CommonModule]
    })
    export class HelloWorldWithNgrxModule { }


    I created a Workspace No Application, only for generate my personal lib

    When i try to build the lib with comand ng build hello-world-with-ngrx i recive this error

    ✖ Compiling with Angular sources in Ivy partial compilation mode.
    projects/hello-world-with-ngrx/src/lib/hello-world-with-ngrx.component.ts:10:20 - error NG8004: No pipe found with name 'async'.


    Link for repo: https://github.com/giolongo/gle-angular-lib/tree/master/projects/hello-world-with-ngrx/src/lib

    How can i resolve it issue?

    Continue reading...

Compartilhe esta Página