AnswerEditComponent

The same recommendation will also work for the AnswerEditComponent upgrade; the only real difference here is the answer's Value numeric property, which will require some specific code in the component's class file:

[...]createForm() {    this.form = this.fb.group({        Text: ['', Validators.required],        Value: [0,            [Validators.required,            Validators.min(-5),            Validators.max(5)]        ]    });}[...]

Also, it will require some specific code in the template file:

[...]<div class="form-group"    [ngClass]="{ 'has-error has-feedback' : hasError('Value') }">    <label for="value">Score Value:</label>    <br />    <select id="value"            formControlName="Value" required            class="form-control">        <option *ngFor="let num of [-5,-4,-3,-2,-1,0,1,2,3,4,5]"                [value]="num">

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.