下面是代码:NG-模型中选择不与工作纳克提交
HTML
<form ng-submit="fun()">
<select ng-model="a" ng-options="table.id as table.name for table in tables></select>
<input type="text" ng-model="b">hello</input>
<input type="submit">Ok</input>
</form>
JS
$scope.tables = [{"id":1, "name":"x"},{"id":2, "name":"y"},{"id":3, "name":"z"}];
//This is dummy data, tables is actually coming from another custom API
$scope.fun = function(){
console.log($scope.a);
console.log($scope.b);
}
这是输出:
undefined
hello
当我检查源代码时,选项将追加到我的选择看起来像这样:
<option label="x" value="undefined:undefined"></option>
我怎样才能在ng-submit控制器中选择选项?
提供表DAT一个 – 2017-04-05 09:11:05
你不附加任何选择选择。 –
当您呈现HTML时,您可以在下拉列表中看到哪些选项? – cezar