manoji stack
manoji stack

Reputation: 739

On click how to hide the button and make display the image in angular?

the requirement is: Initially the image will not be display, I have a button, on click of that button the button. the button should hide and display the image next to that. I tried by this switch case, but its not correct way.

http://jsfiddle.net/4ogjkzyb/

code

app.controller('Approve-ass-controller', function($scope) {
$scope.firstbtnapprove=true;
$scope.secondbtnapprove=true;
$scope.thirdbtnapprove=true;
$scope.firstApprove=false;
$scope.secondApprove=false;
$scope.thirdApprove=false;
$scope.showApprove=function(tag){
    switch(tag){
        case  'first':
        $scope.firstApprove=true;
        $scope.firstbtnapprove=false;
        break;
        case 'second':
        $scope.secondApprove=true;
        $scope.secondbtnapprove=false;
        break;
        case 'third':
        $scope.thirdApprove=true;
        $scope.thirdbtnapprove=false;
        break;
     }
    }
  });

So some one help me out in this. Thanks

Upvotes: 0

Views: 812

Answers (1)

Dayan Moreno Leon
Dayan Moreno Leon

Reputation: 5435

in general form is really simple to do what you want

 <span>
   <button ng-hide="working" ng-click="working=true; somethingElse()">
      Do Some Work
   </button>
   <img src="some/path"  ng-show="working">
 </span>

w/o more details and a working example this should do i

Upvotes: 1

Related Questions