我正在使用cordovadatepicker插件,当我点击选择日期选择器对话框未打开的日期时,我遇到了问题。
我收到错误:
"TypeError: Object 9/17/2015/10/16 has no method 'getMonth'
at DatePicker.show (file:///android_asset/www/plugins/cordova-plugin-datepicker/www/android/DatePicker.js:30:32)
at Object.show (file:///android_asset/www/lib/ngCordova/dist/ng-cordova.min.js:7:16910)
at Scope.$scope.ShowDate (file:///android_asset/www/dist/dist_js/app/controllers.js:1863:43)
at $parseFunctionCall (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:20270:18)
at file:///android_asset/www/lib/ionic/js/ionic.bundle.js:52468:9
at Scope.$eval (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:22326:28)
at Scope.$apply (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:22425:23)
at HTMLLabelElement.<anonymous> (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:52467:13)
at HTMLLabelElement.eventHandler (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:10939:21)
at triggerMouseEvent (file:///android_asset/www/lib/ionic/js/ionic.bundle.js:2856:7)"
这是我的代码:
在视图中:
<label class="item item-input">
<input type="text" name="SheetDate" placeholder="Select Date" value="{{TimeSheetDate.SelectDate | date:'MMMM dd, yyyy' }}"
datetime="yyyy-MM-dd" required readonly>
<i class="icon ion-android-calendar placeholder-icon" ng-click="ShowDate()"></i>
</label>
控制器中的:
var options = {
date: new Date(),
mode: 'date', // or 'time'
allowOldDates: true,
allowFutureDates: false,
doneButtonLabel: 'DONE',
doneButtonColor: '#F2F3F4',
cancelButtonLabel: 'CANCEL',
cancelButtonColor: '#000000'
};
$scope.ShowDate = function () {
try {
$q.when($cordovaDatePicker.show(options)).then(function (date) {
// alert(date);
TimeSheetDate.SelectDate=date;
fetchedDetail(TimeSheetDate.SelectDate);
});
}
catch (e){
console.log(e);
}
};
我的索引文件脚本:
<!-- build:js dist_js/modules.js -->
<script src="lib/ionic/js/ionic.bundle.js" type="text/javascript"></script>
<script src="lib/angular-resource/angular-resource.min.js" type="text/javascript"></script>
<script src="lib/underscore/underscore-min.js" type="text/javascript"></script>
<script src="lib/ngmap/build/scripts/ng-map.min.js" type="text/javascript"></script>
<!--<script src="lib/ngCordova/dist/ng-cordova.min.js" type="text/javascript"></script>-->
<script src="lib/moment/min/moment.min.js" type="text/javascript"></script>
<script src="lib/angular-moment/angular-moment.min.js" type="text/javascript"></script>
<script src="lib/angular-slugify/dist/angular-slugify.min.js" type="text/javascript"></script>
<script src="lib/collide/collide.js" type="text/javascript"></script>
<script src="lib/ionic-contrib-tinder-cards/ionic.tdcards.js" type="text/javascript"></script>
<script src="lib/ngCordova/dist/ng-cordova.min.js" type="text/javascript" ></script>
<script src="lib/ionic-material/dist/ionic.material.js" type="text/javascript"></script>
<script src="lib/waves/dist/waves.js" type="text/javascript"></script>
<!-- endbuild -->
<script src="lib/ngStorage.min.js" type="text/javascript"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js" type="text/javascript"></script>
<!-- build:js dist_js/app.js -->
<script src="dist/dist_js/app/app.js" type="text/javascript"></script>
<script src="dist/dist_js/app/controllers.js" type="text/javascript"></script>
<script src="dist/dist_js/app/directives.js" type="text/javascript"></script>
<script src="dist/dist_js/app/filters.js" type="text/javascript"></script>
<script src="dist/dist_js/app/services.js" type="text/javascript"></script>
<script src="dist/dist_js/app/factories.js" type="text/javascript"></script>
<script src="dist/dist_js/app/templates.js" type="text/javascript"></script>
<script src="dist/dist_js/app/config.js" type="text/javascript"></script>
<script src="http://maps.google.com/maps/api/js"></script>
我没有得到我做错的地方。帮帮我。