title: How to add a html button with angularjs with a working ng-click function
body: <p>I am working on a game made with angularjs. I have one problem that I haven't been able to solve yet. I would like to use a popup dialog ( no alert ) whose content depends on the context. This popup contains a button, that when clicked starts the game.</p>
  
  <p>Since the content is dynamic the ng-click function does not work. </p>
  
  <p>I've tried with directives and straight from the controller but have not gotten it to work.</p>
  
  <p>My concrete question is how do I add HTML Button to a  with angularjs that contains a ng-click function that will actually fire?</p>
  
  <p>Edit: here one attempt (that actually gets the button to show, but ng-click does nothing):
  Controller:</p>
  
  <pre><code>    {
         if ($scope.quiz.state === 'finished' || $scope.quiz.state === 'initialized') {
             var startButton = '&lt;br&gt;&lt;br&gt;&lt;button data-ng-click="startQuiz"&gt;start quiz&lt;/button&gt;';
             $scope.popupText = $sce.trustAsHtml('Stating ' + quiz.name + startButton);
             $scope.showStart = false;
             $scope.showPopup = true;
         }
      };
      $scope.startQuiz = function() {
          $scope.showPopup = false;
          if ($scope.quiz.state === 'initialized') {
               $scope.quiz.start();
               $scope.quizTimer.start($scope, $timeout);
          }
      };
  </code></pre>
  
  <p>Html:</p>
  
  <pre><code>&lt;div id="popupBox"&gt;
      &lt;div id="closePopup" data-ng-click="closePopup()"&gt;X&lt;/div&gt;
      &lt;div data-ng-bind-html="popupText"&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>