QuestionEditComponent

The QuestionEditComponent poses no threat; its form structure is even simpler than QuizEditComponent. For this very reason, it can be a perfect exercise for the reader; all it takes is to retrace the steps of what we already did and repeat the exact same tasks. The form property, the injected fb: FormBuilder, the createForm(), and updateForm() methods, the tempQuestion instance to use within the onSubmit() method, and so on.

Just remember to set the QuizId variable to the tempQuestion instance, as the Entity Framework Data Provider will need it to create and/or update the question:

[...]onSubmit() {    // build a temporary question object from form values    var tempQuestion = <Question>{}; tempQuestion.Text = this.form.value.Text; ...

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.