Angular,选择列表不填充viewModel

时间:2016-12-04 17:31:40

标签: angularjs

我正在从api返回看起来像这样的数据:

[
   {
      createDate:'somedate',
      updateDate:'someOtherDate',
      id: 'abx123ef2D-00-4d256d', //this is a Guid
      name: 'stateName'
   },
   {
      createDate:'somedate',
      updateDate:'someOtherDate',
      id: 'a different Guid here', //this is a Guid
      name: 'stateName'
   }
]

这是我的选择列表:

            <select id="State"
                    ng-model="viewmodel.newRegion.stateId"
                    class="form-control"
                    ng-options="state.id as state.name for state in viewModel.states">
                <option value="">Select State</option>
            </select>

但是当我去运行提交时,我没有任何newRegion.id。

任何人都可以帮忙吗?

0 个答案:

没有答案