Answer the question
In order to leave comments, you need to log in
Directives ng-show, ng-hide, how to use?
There are 2 buttons, when the page is loaded, only one button is visible, how can I make it so that by clicking on the first button, this button disappears and another appears, and vice versa?
Did it like this:
<button class="btn btn-start" ng-click="startOrStop()" ng-bind="buttonText"></button>
var isStart = false;
var isStop = false;
$scope.buttonText = "Start";
$scope.startOrStop= function() {
if (isStart) {
$scope.start();
isStart = false;
isStop = true;
$scope.buttonText = "Stop";
}
if (isStop) {
$scope.stop();
isStop = false;
$scope.buttonText = "Start";
} else {
$scope.start();
isStop = true;
$scope.buttonText = "Stop";
}
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question