如何在标题中显示标题,同时与离子中选择的日期相对应?
我的模板标题html:
<ion-view cache-view="false" title="{{ currentDate | date:'MMM dd, yyyy' }}">
<ion-nav-buttons side="secondary">
<button class="button-icon icon ion-calendar assertive" ng-click="datePicker()"> </button>
</ion-nav-buttons>
//Input your content
</ion-view>
我的controller.js
$scope.currentDate = new Date();
$scope.date = [];
$scope.datePicker =function($event) {
var options = {
date: new Date(),
mode: 'date'
};
datePicker.show(options, function(date){
if(date != 'Invalid Date') {
console.log("Date came" + date);
$scope.currentDate = date;
console.log($scope.date);
} else {
$scope.currentDate = date;
console.log(date);
}
});
$event.stopPropagation();
}
对于日期时间选择器,我使用this plugin。
先谢谢!