用 js 給 input 的ng-model 賦值

用jQuery能夠實現 將input的值綁定到ng-mode 上ui

 $("#id").val(value).trigger('change');code

 

<uib-tabset class="tab-container tabbable-line">
            <uib-tab heading="續住信息">
                <div class="row clearfix" style="margin-top:10px;">
                    <div class="col-sm-12">
                        <div class="form-group form-float">
                            <div class="form-line">
                                <input id="startTime" type="text" name="startTime" ng-model="vm.checkInContinue.startTime" required maxlength="32" class="datepicker validate form-control">
                                <label for="startTime" class="form-label">續住開始時間</label>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row clearfix">
                    <div class="col-sm-12">
                        <div class="form-group form-float">
                            <div class="form-line">
                                <input id="endTime" type="text" name="endTime" ng-model="vm.checkInContinue.endTime" required maxlength="32" class="datepicker validate form-control">
                                <label for="endTime" class="form-label">續住結算時間</label>
                            </div>
                        </div>
                    </div>
                </div>
                <script>
                        $(document).ready(function () {
                            $('#startTime').datepicker({
                                changeMonth: true,
                                changeYear: true,
                                dateFormat: "yy-mm-dd",
                                onSelect: function (dateText, inst) {
                                    $("#startTime").val(dateText).trigger('change');
                                    setTimeout("$.AdminBSB.input.activate()", 10)
                                }
                            }
                            );
                            $('#endTime').datepicker({
                                changeMonth: true,
                                changeYear: true,
                                dateFormat: "yy-mm-dd",
                                onSelect: function (dateText, inst) {
                                    $("#endTime").val(dateText).trigger('change');
                                    setTimeout("$.AdminBSB.input.activate()", 10)
                                }
                            }
                            );
                        });
                    </script> 
            </uib-tab>
        </uib-tabset>
相關文章
相關標籤/搜索