Angularjs 输入干扰枚举选择的NGM模型
我的代码有问题。 因此,我尝试创建一个表单来接收用户的信息,并将其添加到组件的属性中。为此,我使用了双向绑定,以及一些输入和选择。 我的选择正在从枚举接收选项。 问题是,当我在输入或选择中使用ngModel时,我的选择选项将消失Angularjs 输入干扰枚举选择的NGM模型,angularjs,select,input,enums,angular-ngmodel,Angularjs,Select,Input,Enums,Angular Ngmodel,我的代码有问题。 因此,我尝试创建一个表单来接收用户的信息,并将其添加到组件的属性中。为此,我使用了双向绑定,以及一些输入和选择。 我的选择正在从枚举接收选项。 问题是,当我在输入或选择中使用ngModel时,我的选择选项将消失 <div class="container"> <div class="form"> <input type="text" placeholder="Bran
<div class="container">
<div class="form">
<input type="text" placeholder="Brand" [(ngModel)]="newItem.brand" />
<input type="text" placeholder="Model" [(ngModel)]="newItem.model" />
<input type="text" placeholder="Price" [(ngModel)]="newItem.price" />
<textarea
placeholder="Description"
[(ngModel)]="newItem.description"
></textarea>
<select class="form-control" [(ngModel)]="newItem.genre">
<option value="" disabled selected>Gender</option>
<option *ngFor="let genre of genres.select()" value="{{ genre.key }}">
{{ genre.value }}
</option>
</select>
<select class="form-control" [(ngModel)]="newItem.notes">
<option value="" disabled selected>Notes</option>
<option *ngFor="let note of notes.select()" value="{{ note.key }}">
{{ note.value }}
</option>
</select>
<select class="form-control" [(ngModel)]="newItem.size">
<option value="" disabled selected>Size of bottle</option>
<option *ngFor="let size of sizes.select()" value="{{ size.key }}">
{{ size.value }}
</option>
</select>
<select class="form-control" [(ngModel)]="newItem.type">
<option value="" disabled selected>Type</option>
<option *ngFor="let type of types.select()" value="{{ type.key }}">
{{ type.value }}
</option>
</select>
<input
type="text"
placeholder="Img URL"
[(ngModel)]="newItem.image"
/>
</div>
<button class="btn">CREATE</button>
</div>
性别
{{genre.value}}
笔记
{{note.value}}
瓶子大小
{{size.value}}
类型
{{type.value}}
创造
我真的不知道我做错了什么,也不知道我是怎么做的。
如果你们能帮我,那就太好了
提前谢谢