角度下拉列表未传递正确的值

时间:2016-06-06 14:38:33

标签: javascript angularjs forms directive

我编写了一个指令,作为功能的一部分,读取下拉菜单并将值传递回API。在调查网络信息之后,我确定它没有检测到值的变化,并且总是只传递默认值“none”。不幸的是我无法设置它的演示,但我希望有人可以查看我下面的代码片段并告诉我我的错误可能在哪里。非常感谢你们。

JS:

<form name="filtersForm" ng-submit="save()" autocomplete="off">
    <div class="row">
        <div class="col-md-5">
            <h4><i class="fa fa-info-circle"></i> <strong>Filter Information</strong></h4>
        </div>
    </div>
    <div class="row" style="border-top: 1px solid #ddd; padding-top: 10px">
         <div class="col-md-12">
             <div class="form-horizontal">
                 <div class="col-md-6">
                     <div class="form-group">
                         <label for="description" class="col-sm-4 control-label">Description </label>
                         <div class="col-sm-8">
                             <input ng-disabled="filter.priority<1"  id="description" ng-model="filter.description" class="form-control" required>
                          </div>
                     </div>
                     <div class="form-group">
                         <label for="sendFollowup" class="col-sm-4 control-label">Followup</label>
                         <div class="col-sm-8">
                             <div class="checkbox normal-text">
                                 <label>
                                      <input type = "checkbox" id="sendFollowup" ng-model="filter.sendFollowup">
                                            Send followup?
                                  </label>
                              </div>
                          </div>
                      </div>
                  </div>
                  <div class="col-md-6">
                      <div job-type-search="filter" model-type="filter" validate="validate" autocomplete="off"></div>
                            <div class="form-group">
                                <label for="alertType" class="col-sm-4 control-label">Alert Type: </label>
                                <div class="col-sm-8">
                                    <select class="form-control" id="alertType" ng-model="filter.alert.type" convert-to-string required>
                                        <option value="none">No Alert</option>
                                        <option value="silence">Vibrate Alert</option>
                                        <option value="audio">Audio Alert</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row" style="border-top: 1px solid #ddd; padding-top: 10px">
                <div class="col-md-3 col-md-offset-4">
                    <div class="form-group">
                        <button type="submit" class="btn btn-primary btn-block" ng-class="{'btn-success': saved === 'Saved!'}" ng-disabled="saved === 'Saving...' || filtersForm.$invalid || (!validate && filter.value!==null)">{{saved}}</button>
                    </div>
                </div>
            </div>
        </form>

HTML:

{{1}}

0 个答案:

没有答案