I'm wondering if anyone would like to share their useful patterns for giving static types to Json server responses? How do people treat this data in the objects they emit from their Service? I'd rather not have dynamically typed json data floating around my app.
I can think of two obvious ways, one is to have an interface that corresponds to the expected structure for the response and just cast the response to the interface. Problem I see there is that an interface can't do any adjustments. Second would be an object with a constructor or factory function that takes the untyped json and spits out an instance. Sometimes that gets rather verbose though when there's a lot of data fields to deal with. I'm hoping someone has some clever pattern that might be better than my two initial ideas? Thanks! -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
