javascript - AngularJS: Hide button after click -


new angular , struggling how things "angular way". want click button show hidden element inside view hide button clicked. awesome.

html:

<button class="btn btn-primary" ng-click="showdiv=true; hideme()">   show div </button> <div ng-show="showdiv">   hidden see me, how hide button? </div> 

controller:

  $scope.hideme = function(){     console.log('hide button');     $scope.hide();   } 

code sample: plunker

ideally incorporate

ng-hide
on button , not have function run inside of controller.

<button ng-hide="showdiv"... 

should work also


Comments