我将当前日显示为默认值,并在用户选择后显示另一个日期
我的问题是:在用户选择WHERE 'CHE' IN (a.TeamAbbreviation, b.TeamAbbreviation);
中的日期后,如何隐藏TodayDate
div。
所以基本上我想要隐藏一个日期并显示所选的新日期。
HTML:
activeDate
角:
<div>: {{TodayDate | date:"dd-MM-yyyy"}} </div>
<h4 class="pull-left" ng-show="activeDate">
Active date: <span>{{activeDate}}</span>
</h4>
答案 0 :(得分:1)
<div ng-hide="activeDate">: {{TodayDate | date:"dd-MM-yyyy"}} </div>
<h4 class="pull-left" ng-show="activeDate">
Active date: <span>{{activeDate}}</span>
</h4>
这是你需要的吗?找到activeDate时隐藏TodayDate Div。
答案 1 :(得分:1)
HTML,
<div ng-hide="date">: {{TodayDate | date:"dd-MM-yyyy"}} </div>
<h4 class="pull-left" ng-show="date">
Active date: <span>{{activeDate}}</span>
</h4>
Angular code,
function link($scope, $element) {
var $datepicker = $element.find('.date-picker').datepicker();
$scope.TodayDate = new Date();
$scope.activeDate = '';
$scope.date = false;
$datepicker.change(function() {
$scope.activeDate = $(this).find('input').val();
$scope.date = true;
// Because the datepicker change happens outside of the Angular digest,
// we need to call the apply method
$scope.$apply();
});
}
添加了一个变量$scope.data
来管理展示和隐藏。