DEV Community

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

Collapse
 
amineamami profile image
amineamami • Edited

That code snippet works like a charm i’m using it currently it been like that since angular 5 or 4 not sure, your right about the date thingy but if you send it from backend as a date type. You’ll get it as a date type too in angular.

Thread Thread
 
florimondmanca profile image
Florimond Manca

Cool! Glad to hear simple type conversions work.

To my knowledge there is no Date type in JSON, though, so that still means the model-adapter pattern is needed in more complex use cases.

Thread Thread
 
amineamami profile image
amineamami

In typescript/JavaScript there is obviously, you’ll access it like a normal property Obj.dateProperty