部分视图上使用MVC的日期范围选择器AngularJS的问题
部分视图上使用MVC的日期范围选择器AngularJS的问题 当我们尝试加载我的应用程序时,我的文本框显示为daterange选择器的[object object]。为什么不在文本框中显示daterange部分视图上使用MVC的日期范围选择器AngularJS的问题,angularjs,asp.net-mvc,partial-views,Angularjs,Asp.net Mvc,Partial Views,部分视图上使用MVC的日期范围选择器AngularJS的问题 当我们尝试加载我的应用程序时,我的文本框显示为daterange选择器的[object object]。为什么不在文本框中显示daterange $scope.date = { startDate: moment().subtract(1, "days"), endDate: moment() }; $scope.SimplePickerChange = function(){ alert('hi');
$scope.date = {
startDate: moment().subtract(1, "days"),
endDate: moment()
};
$scope.SimplePickerChange = function(){
alert('hi');
$scope.date = {
endDate:$scope.date.startDate.add(30,"days")
}
alert(JSON.stringify($scope.date));
};
$scope.singleDate = moment().add(30, "days");
$scope.opts = {
locale: {
applyClass: 'btn-green',
applyLabel: "Apply",
fromLabel: "From",
format: "YYYY-MM-DD",
toLabel: "To",
cancelLabel: 'Cancel',
customRangeLabel: 'Custom range'
},
ranges: {
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()]
}
};
$scope.setStartDate = function () {
$scope.date.startDate = moment().subtract(4, "days").toDate();
};
$scope.setRange = function () {
$scope.date = {
startDate: moment().subtract(5, "days"),
endDate: moment()
};
};
//Watch for date changes
$scope.$watch('date', function(newDate) {
console.log('New date set: ', newDate);
}, false);
它是[object object],因为它试图将
.toString()
强制转换为它。你能先显示你的代码吗?