I need to switch between to div's. Div class="wrapper"
must be visible by default. Div class="form"
must be shown after admin approve. The problem is when i click on <a ng-click="toggle()">
it works only once, and no reaction after. If i will add some ng-hide
to 'wrapper', ng-click
works, but show/hide only 'form'. <a>
must be shown after controller response, like class="form"
.
HTML:
<div class="body" ng-class="{'show': show && showTemp}">
<a ng-click="toggle()"></a>
<div class="form"></div>
<div class="wrapper"></div>
</div>
CSS:
.form {
display: none;
}
.wrapper {
display: block;
}
.show .form {
display: block;
}
.show .wrapper {
display: none;
}
Controller:
$scope.show = false;
$scope.showTemp = true;
// response from admin
$scope.$on('$show', function(e,data) {
$scope.show = true;
$scope.available = data;
});
// this click by user
$scope.toggle = function() {
$scope.showTemp = !$scope.showTemp;
};