New to Angular and struggling with how to do things the "Angular Way". All I want to do is click a button to show a hidden element inside a view then hide the button that was clicked. Any help would be awesome.
HTML:
<button class="btn btn-primary" ng-click="showDiv=true; hideMe()">
  Show Div
</button>
<div ng-show="showDiv">
  I was hidden now you see me, but how do I hide the button?
</div>
Controller:
  $scope.hideMe = function(){
    console.log('hide the button');
    $scope.hide();
  }
Code sample: Plunker
Ideally would like to incorporate
ng-hideon the button and not have a function run inside of the controller.
<button ng-hide="showDiv"...
Should work also
Just add ng-show="!showDiv" to your button, this will hide it if showDiv = true
Just to be clear new html should look:
<button class="btn btn-primary" ng-click="showDiv=true" ng-show="!showDiv">Show Div</button>
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With