To add a comment to @vp_arth, you do not need both. But you're on the right track with a boolean flag.
I would suggest making the following changes:
Add this object to the control area:
$scope.ui = { showDiv: false };
And in the template, change the button to:
button ng-click="ui.showDiv = !ui.showDiv" /
And instead of ng-show and ng-hide use:
ng-show="ui.showDiv"
This way you don't need the catitems2 () function, and the div or what you want to show starts to hide.
Here's the working JSFiddle of the changes:
http://jsfiddle.net/Lvc0u55v/6534/
source share