1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Angular Signals and Component Structure

Discussão em 'Angular' iniciado por StuAtApmg, Outubro 1, 2024.

  1. StuAtApmg

    StuAtApmg Guest

    I have watched various Angular 18 courses such as those by Deborah Kurata and it seems that the recommended pattern is as follows.

    UI Component <-- Signals <-- Observable <-- Web Api <-- Database etc.

    Only the service contains Observables and the UI makes use of Signals in the service that wrap the observables.

    I am trying to understand how this works in my example. I have a search UI component, list UI component and a service. The search UI component contains the various search fields to find a customer. The list component shows a list of customers. The service component invokes a web api to get the customers based on the search components.

    Can't work out the correct calling sequence. Should the list component iterate through the list signal of the service. The service would need to know the search parameters to do this.

    Does the service contain class variables to allow the search params to be set by the search ui component? This would not trigger the observable to run so do I make the search params also signals ?

    The service is working as expected. I do have a side issue in that for some reason the list will not iterate through the signal wrapped observable but will iterate via the observable if I subscribe to it.

    Continue reading...

Compartilhe esta Página