我想在表单中使用<select>
以让用户能够更新不同<option>
之间的值。我在这里使用了指南中的技术:https://angular.io/docs/ts/latest/guide/forms.html。这是我讲的样品:它要求从myApp.services的updateOrder()Angular 2:如何从表单的不同选项中获取选定的值?
<div class="form-group">
<label for="type">Type :</label>
<select class="form-control" [(ngModel)]="order.type" ngControl="type">
<option *ngFor="#type of types" [value]="type">{{type}}</option>
</select>
</div>
在我的订单details.component我有一个updateOrder()。
我的问题是当我试图将数据从表单发送到后端:<input>
的所有部分都可以,但不是那些与<select>
(它返回原始值,而不是所选的一个)。
有没有人遇到过这样或类似的问题? 感谢您的帮助!
看起来像一个dup http://stackoverflow.com/questions/34686855/angular2-access-a-select-event-change-within-the-component –