Just started learning Angular and finding it difficult to follow the "Angular Way". I want to achieve a simple task of clicking a button to display a hidden element in a view, then hide the button that was clicked. Any tips or assistance would be greatly appreciated.
Here is the HTML snippet:
<button class="btn btn-primary" ng-click="showDiv=true; hideMe()">
Show Div
</button>
<div ng-show="showDiv">
I was hidden before, but now you can see me. How do I hide the button though?
</div>
And here is the controller code:
$scope.hideMe = function(){
console.log('hide the button');
$scope.hide();
}
If you'd like to check out a working example, feel free to visit this Plunker link.
My goal is to use
ng-hideon the button itself without needing a function within the controller.