I'm looking to implement an Angular service that interacts with an 
enterprise RESTful API using Angular's new signal and resource features. 
Most of the examples I've found demonstrate making API calls directly 
within components with a signal for each input to that API call, but I want 
to adhere to best practices by encapsulating this logic within a dedicated 
service.

Here's the structure of my API responses:
export interface ApiResponse<T> { success: boolean; message: string; 
statusCode: number; data: T; } 


Can anyone provide a simple example of how to use signals and the resource 
API with a GET and POST that take in parameters for a service?

I'm especially wondering how the input parameters would work. Surely you 
wouldn't need to make a computed signal (along with the other signals it 
references) for every single endpoint method.


I could also be looking at this completely wrong, and maybe these aren't 
the best things to use for it. Our team is pretty new to Angular, so we're 
still trying to figure out best practices so we can come up with a standard.

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/angular/45147f48-9a34-48db-9106-1c1ede6129cen%40googlegroups.com.

Reply via email to