search

Home  >  Q&A  >  body text

javascript - angularJs cannot get the ng-model value of date-range-picker

//Date control

    $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();
            }
        }
    }

This is js code, the code is in the same js; after determining the time box, you can enter this method, but the time box in ng-include cannot get the value after clicking. I would like to ask for a solution ?

伊谢尔伦伊谢尔伦2697 days ago769

reply all(1)I'll reply

  • 怪我咯

    怪我咯2017-06-26 10:59:36

    You can define an object such as obj outside, and then bind an ng-model="obj.submitTime" to the ng-model. The reason may be that the Scope of the unavailable ng-model is actually an outer layer. The obtained subScope.

    reply
    0
  • Cancelreply