a.inputObj.inputDate.getFullYear不是离子datepicker中的函数错误

时间:2015-12-17 05:48:47

标签: angularjs ionic

我正在使用离子日期选择器来选择日期: https://github.com/rajeshwarpatlolla/ionic-datepicker

<ionic-datepicker input-obj="dateofbirthObject">
    <button class="button button-clear" data-ng-model="personalDetailsObj.personalDetails.dob" name="dob" ng-disabled="isReadonly"> {{dateofbirthObject.inputDate | date:'dd - MMMM - yyyy'}}</button>
</ionic-datepicker>

控制器

$scope.personalDetailsObj.personalDetails = {
"dob":"2015-01-13T18:30:00.000+0000"
}



  $scope.dateofbirthObject = {            
          inputDate: new Date(),  //Optional      
          disabledDates: disabledDates, //Optional
          weekDaysList: weekDaysList, //Optional
          monthList: monthList, //Optional
          templateType: 'popup', //Optional
          showTodayButton: 'false', //Optional      
          from: new Date(1970, 1, 1), //Optional
          to: new Date(),  //Optional
          callback: function (val) {  //Mandatory
            datePickerCallback(val);
          },
          dateFormat: 'dd-MM-yyyy',
          closeOnSelect: false
        };

        var datePickerCallback = function (val) {
          if (typeof(val) === 'undefined') {
            //console.log('No date selected');
          } else {
            $scope.dateofbirthObject.inputDate = val;
            //console.log('Selected date is : ', val);
          }
        };

$scope.dateofbirthObject.inputDate = $scope.personalDetailsObj.personalDetails.dob;

我试图分配从服务器获取的值(即出生日期)不起作用,得到错误说: TypeError:a.inputObj.inputDate.getFullYear不是函数 < / p>

0 个答案:

没有答案