我已经使用我的接口渲染了以下数据,其中0表示{{x.count}},今天、明天和随后的日期来自接口中的{{x.day}}。
今天0个约会
明天0个约会
周三0次预约
周四0次预约
周五0次预约
我的HTML视图如下所示:
<span ng-repeat="x in scheduledAppointments_report"><a ng-click="test(x.day);">{{x.count}} Appoinments {{x.day}}</a> <br/><br/></span>我想在各自的超链接点击上检索日期。
请让我知道解决方案。
谢谢
发布于 2017-05-08 14:36:16
尝试如下所示:
<div ng-app>
<div ng-controller="MyApp">
<a href="#" ng-click="get_x_day_date(0)">Today</a>
<a href="#" ng-click="get_x_day_date(1)">Tomorrow</a>
</div>
</div>和代码:
function MyApp($scope) {
$scope.today = new Date();
$scope.get_x_day_date = function(index) {
$scope.x_day = new Date();
$scope.x_day.setDate($scope.today.getDate() + index);
alert($scope.x_day);
return $scope.x_day;
}
}https://stackoverflow.com/questions/43840479
复制相似问题