Angularjs 角度形状不采用选择选项值

Angularjs 角度形状不采用选择选项值,angularjs,select,Angularjs,Select,我有一张表格,在ng提交时提交。表单中有一个表,其中有一个选择框。我无法将选择框中选择的值传递给控制器内的函数。这是密码 <form name="formExeOptions" role="form" novalidate class="ng-scope ng-invalid ng-invalid- required ng-dirty ng-valid-minlength" ng-submit="createExecutionStepOption(caseExecution.id

我有一张表格,在ng提交时提交。表单中有一个表,其中有一个选择框。我无法将选择框中选择的值传递给控制器内的函数。这是密码

<form name="formExeOptions" role="form" novalidate class="ng-scope ng-invalid ng-invalid- 
    required ng-dirty ng-valid-minlength" ng-submit="createExecutionStepOption(caseExecution.id,formExeOptions.optionSel.value)">
    <h4>Add an execution step option</h4>

    <div class="table-responsive">
        <table>
            <thead>
                <tr>
                    <th>Step</th>
                    <th>Name</th>
                    <th>Value</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>
                        <select name="optionSel">
                            <option name="TOPPER" value="1" selected>TOPPER</option>
                            <option name="RSC" value="2">RSC</option>
                            <option name="SPD" value="3">SPD</option>
                            <option name="SFT" value="4">SFT</option>
                            <option name="LMP" value="5">LMP</option>
                        </select>
                    </td>
                    <td>
                        <input type="text" class="form-control" name="nameOption" ng-model="exeoption.name">
                    </td>
                    <td>
                        <input type="text" class="form-control" name="valueOption" ng-model="exeoption.value">
                    </td>
                    <td>
                        <button type="submit" class="btn btn-default">
                            <span class="glyphicon glyphicon-plus"></span>
                        </button>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</form>

添加一个执行步骤选项
步
名称
价值
托普
RSC
社民党
SFT
LMP

有人能提供正确的语法吗?

我对将
选项sel
绑定到范围值并在提交函数中检查它做了评论

首先,我将您的
select
标记更改为:

<select name="optionSel" ng-model="selectedOption" ng-options="option.value as option.name for option in options"></select>

您没有尝试传递事件。您已经通过
ng model
绑定到输入上的模型,为什么不使用
选项sel
执行相同的操作<代码>选择元素也受
ng型号
支持。然后,您不需要将任何内容传递到submit函数中;只需将该函数内的值与绑定它的作用域上的值进行检查。
// define your array of possible options
$scope.options = [
    {name: 'TOPPER', value:'1'},
    {name: 'RSC', value:'2'},
    {name: 'SPD', value:'3'},
    {name: 'SFT', value:'4'},
    {name: 'LMP', value:'5'},
  ];

$scope.selectedOption = '1'; // default value

// omitted for brevity

// your submit function
$scope.createExecutionStepOption = function(caseExecutionId) {
  // do whatever. you can access the selected option using $scope.selectedOption
};