Convert filter pipe to Angular computed signal

Discussão em 'Angular' iniciado por Dakado, Março 20, 2025.

  1. Dakado

    Dakado Guest

    I use RxJS filter pipe to trigger data reload from the REST server only when selectedId is not null. How do I transfer the observable into signal/computed signal achieving same effect as with the filter pipe?

    this.selectService.selectedId$.pipe(filter(selectedId=> selectedId!= null)).subscribe(
    this.restService.loadData(...);
    );


    Ideally I would like the signal not to trigger when then value is null/undefined, cause then it would cause a data load for null id from the server.

    Is this even possible to do with computed signals?

    Continue reading...

Compartilhe esta Página