The first thing we need to do is to add the Quiz interface to our Angular-enabled client. Wait a minute, should we really do that? Can’t we just use the raw JSON data sent by the QuizController’s Get and GetLatest methods defined earlier, consuming them as anonymous JavaScript objects?
Theoretically speaking, we can, just as much as we can output raw JSON from the Controllers instead of creating all the ViewModel classes, like we did instead. In a well-written app, though, we should always resist the temptation to handle raw JSON data and/or to use anonymous objects for a number of good reasons:
- We have chosen TypeScript over JavaScript because we want to work with type definitions. Anonymous objects and properties ...