AnswerEditComponent

The AnswerEditComponent is so much similar to the QuestionEditComponent--at least for the time being--that we can just copy and paste the question-edit.component.ts file, rename it as answer-edit.component.ts, and perform the following changes:

  • Replace Question with Answer and question with answer
  • Replace Quiz with Question and quiz with question

Ensure that you follow the given order; also, if you plan to do it automatically, don't forget to activate the case-sensitive switch from within your text editor to avoid screwing up the source code!

We were able to do that because we used the same naming conventions for everything, from the Web API server-side routes to to the CSS classes; however, exploiting find and replace in this way is hardly a good behavior, and we only do that because we don't want to overburden this book with source code samples. We strongly suggest the reader to take this chance to try implementing the AnswerEditComponent with the acquired knowledge instead of using the copy and replace trick, as it will be a great exercise to check whether they properly understand everything.

The same trick can be done for the answer-edit.component.css style sheet file; conversely, the template file requires some additional work.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.12.108.175