首页 > 其他 > 详细

[Angular2 Form] Build Select Dropdowns for Angular 2 Forms

时间:2016-09-30 01:00:33      阅读:284      评论:0      收藏:0      [点我收藏+]

Select Dropdowns in Angular 2 a built with select and option elements. You use *ngFor to loop through your values and create options and use ngModel to keep track of the value as it changes.

 

<form #formRef="ngForm">
    <select name="location" [ngModel]="locations[0]">
        <option 
            *ngFor="let location of locations"
            [value]="location">
            
            {{location}}
            
        </option>
    </select>
</form> 

 

[Angular2 Form] Build Select Dropdowns for Angular 2 Forms

原文:http://www.cnblogs.com/Answer1215/p/5921106.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!