Raduken Raduken - 6 months ago 9
AngularJS Question

How to hide a div if the another one is active

I have the current day showing as default and another date showing after selected by user,

My question is: how can I hide

TodayDate
div after the user select a date in
activeDate
.

so basically I want hide one date and show the new date selected.

html:

<div>: {{TodayDate | date:"dd-MM-yyyy"}} </div>
<h4 class="pull-left" ng-show="activeDate">
Active date: <span>{{activeDate}}</span>
</h4>


angular:

function link($scope, $element) {
var $datepicker = $element.find('.date-picker').datepicker();
$scope.TodayDate = new Date();
$scope.activeDate = '';
$datepicker.change(function() {
$scope.activeDate = $(this).find('input').val();

$scope.$apply();
});
}

Answer
<div ng-hide="activeDate">: {{TodayDate | date:"dd-MM-yyyy"}} </div>
<h4 class="pull-left" ng-show="activeDate">
  Active date: <span>{{activeDate}}</span>
</h4>

is this what you need? hide TodayDate Div when activeDate is found.

Comments