changes ng-show/hide to ng-if, and fixes bug with esc key