2015-04-26 71 views
1

我安裝ngCordova日期選擇器,我找不到爲什麼日期選擇器的心不是工作:角ngCordova日期選擇犯規顯示

1)我的看法,我整合了NG-點擊=「日期選擇器()」:

<a ng-click="datepicker()" class="item item-icon-left item-icon-right" href="#"> 
    <img id= "icon_calendar" src="../img/icon_calendrier.svg"/> 
    <p class="time_date"> </p> 
    <img class= "flechedate" src="../img/fleche_bleuclaire.svg"/> 
</a> 

2)我的控制器(以下在ngCordova網站DOC):

angular.module('foot',[]).controller('FootController', function ($scope, $cordovaDatePicker) { 
$scope.foot; 
$scope.datepicker = function(){ 
    var options = { 
    date: new Date(), 
    mode: 'date', // or 'time' 
    minDate: new Date() - 10000, 
    allowOldDates: false, 
    allowFutureDates: true, 
    doneButtonLabel: 'DONE', 
    doneButtonColor: '#F2F3F4', 
    cancelButtonLabel: 'CANCEL', 
    cancelButtonColor: '#000000' 
    }; 
    document.addEventListener("deviceready", function() { 

    $cordovaDatePicker.show(options).then(function(date){ 
     alert(date); 


    }); 

    }, false); 
}; 

}); 

回答

1

看起來你需要在你的角度模塊中包含ngCordova作爲依賴。

angular.module('foot', ['ngCordova']) 
+0

仍然無法正常工作 –

0

結帳這是對工作我
你必須寫在$ ionicPlatform的日期選擇器的功能

$ionicPlatform.ready(function(){ 
     $cordovaDatePicker.show(options).then(function(date){ 
     alert(date); 
     }); 

我上傳示例項目,你在git的樞紐,這是link
有任何疑問,請回復