Skip to content Skip to sidebar Skip to footer

How To Show/hide Button?

I'm making an app with a dynamic page. I have multiple buttons on my page but all buttons should not be visible at once rather visible one after another in consecutive. I need them

Solution 1:

I've been working on an application that shows and hides div elements. Hope you can you proceed with the following example.

    <div class="container" ng-app="showHideApp" ng-controller="showHideController">
       <div class="col-sm-8 col-sm-offset-2">
           <!-- FORM -->
           <div class="form-group">
              <button class="btn btn-danger" ng-click="showMe();">Click me for show</button>
              <button class="btn btn-danger" ng-click="hideMe();">Click me for hide</button>
           </div>
       <div class="form-group" ng-show="show">
         <p>I am showing</p>
       </div>
    </div>
</div>

JS Code:

angular.module('showHideApp',[]).controller('showHideController', function($scope){
       $scope.showMe = function(){
         $scope.show=true;
       }
       $scope.hideMe = function(){
         $scope.show=false;
       }
   });

Post a Comment for "How To Show/hide Button?"