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. java - jvm 年轻代 如何回收 survivor 对象2. java - 对于jsp技术,aspx技术的困惑3. java - idea如何不显示.idea target这些文件夹4. docker-compose中volumes的问题5. python - Django有哪些成功项目?6. dockerfile - [docker build image失败- npm install]7. javascript - [,null]是什么用法8. docker - 各位电脑上有多少个容器啊?容器一多,自己都搞混了,咋办呢?9. javascript - vue vue-router 报$router重复定义10. apache - 怎么给localhost后面默认加上8080端口
