The Quiz client-side interface

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 ...

Get ASP.NET Core 2 and Angular 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.