我有一个下拉菜单,显示从1到8的数字。选择数字3将显示表格开始日期,结束日期,开始时间,结束时间3的div。
如何在数组中绑定这些数据以在Angular控制器中获取它?
答案 0 :(得分:0)
在表单中,为每个要绑定数据的表单添加ng-model。 例如,
Tinamous
Tinamiformes | Tinamidae | Little tinamou | Crypturellus soui | Trinidad only
Screamers
Anseriformes | Anhimidae | Horned screamer | Anhima cornuta | Trinidad only - rare/accidental
Ducks, geese, and waterfowl
Anseriformes | Anatidae | Fulvous whistling-duck | Dendrocygna bicolor | Trinidad only
Anseriformes | Anatidae | White-faced whistling-duck | Dendrocygna viduata | Trinidad only - rare/accidental
...
...
Waxbills and allies
Passeriformes | Estrildidae | Common waxbill | Estrilda astrild | Trinidad, accidental Tobago - introduced species
Passeriformes | Estrildidae | Tricolored munia | Lonchura malacca | Trinidad only - introduced species
Old World sparrows
Passeriformes | Passeridae | House sparrow | Passer domesticus | Trinidad only - Introduced species
在控制器中,您在范围中声明日期对象,以便它绑定在一起。它看起来像这样:
<div>
<input ng-model="date.startingDate" >
<input ng-model="date.endDate" >
<input ng-model="date.startingTime" >
<input ng-model="date.endTime" >
</div>
现在变量绑定到范围,因此您可以动态使用它的值。