htmlangulartypescriptng-modules

Angular NgModel not assigning select value to object parameter


Im trying to assing the value of a select option to the name of an object in Angular. The list of names is showing correctly, but upon submitting the form the value is empty. I did import the FormsModule in app.module.ts like other posts on here say, but that's not the problem I guess.

Anyone able to pass along some wisdom?

<Select [(ngModel)]="object.name" name="name" class="u-border-1 u-border-grey-30 u-input u-input-rectangle u-white" required>
                        <option value="" disabled>Kies naam</option>
                        <option [value]="'Andreas'">Andreas</option>
                        <option [value]="'Lucas'">Lucas</option>
                        <option [value]="'Samen'">Samen</option>
                    </Select>

Solution

  • Answered in comment by akotech:

    It may be because the HTML tag is select with lowercase s.