DEV Community

loading...

Discussion on: Consuming APIs in Angular – The Model-Adapter Pattern

Collapse
avronyc profile image
4lv4r0 • Edited

the generic type you are able to pass to an http get or post, etc... its merely to allow typed responses. The adapter is still needed if your model objects contain any methods, etc. So for instance if you have a method such a getFullName() within your User model, this wont be available for the objects returned by http.get. its still necessary to do a map in order to actually create the User objects based on the data received. Hope this clarifies a bit

angular.io/guide/http#requesting-a...

Forem Open with the Forem app