javascript - angularJs取不到date-range-picker的ng-model值
问题描述

//日期控件
$scope.opts = {locale: { format: ’YYYY/MM/DD’, separator: ’ - ’, applyLabel: ’确定’, cancelLabel: ’取消’, weekLabel: ’W’, customRangeLabel: ’Custom Range’, daysOfWeek: moment.weekdaysMin(), min: ’’, max: ’’, monthNames: moment.monthsShort(), firstDay: moment.localeData().firstDayOfWeek()},eventHandlers: { ’apply.daterangepicker’: function (ev) {if ($scope.submitTime.startDate != ''){ $scope.query.BeginSubmitTime = sourceService.convertData($scope.submitTime.startDate._d); $scope.query.EndSubmitTime = sourceService.convertDataEnd($scope.submitTime.endDate._d);}if ($scope.modifyTime.startDate != '') { $scope.query.BeginCreatetime = sourceService.convertData($scope.modifyTime.startDate._d); $scope.query.EndCreatetime = sourceService.convertDataEnd($scope.modifyTime.endDate._d);}$scope.getProjectAuditPageList(); }} }
这个是js代码,代码是在同一个js中的;确定时间框之后是都能够进入这个方法里面的,只不过ng-include 中的时间框点击后取不到值,想问解决方案?
问题解答
回答1:你在外边定义一个对象比如obj,然后ng-model绑定一个ng-model='obj.submitTime'应该就可以了,原因可能是取不到的那个ng-model所在Scope实际上是外层可以取到的子Scope。
相关文章:
1. golang - 用IDE看docker源码时的小问题2. docker容器呢SSH为什么连不通呢?3. docker api 开发的端口怎么获取?4. 请问一下各位老鸟 我一直在学习独孤九贱 现在是在tp5 今天发现 这个系列视频没有实战5. docker网络端口映射,没有方便点的操作方法么?6. docker绑定了nginx端口 外部访问不到7. Python两个list互换,两种不同的操作结果有差异,原因是什么呢?8. angular.js - Angularjs中点击事件传递参数 给class更换样式。9. javascript - ueditor引入报错问题10. angular.js - 关于指令link 中的创建变量问题

网公网安备