Hide OK-Button on Popup as long as Input is empty



I am trying to create a popup with an input field and two buttons (ok and cancel).
The ok-button should be hidden as long as the input field is empty.
How can I do this? Haven’t found an answer yet.
I figured something like this:

<input type="text" id="message" ng-model="data.message" required="required" onkeypress="$scope.showButton()">'

buttons: [
  {text: 'Abbrechen'},
    text: '<b>OK</b>',
    cssClass: 'ok-button',

$scope.showButton = function (){
  else {

But it does not work. Every hint is highly appreciated!