title: How to make ng-click working on dynamically added button?
body: <p>I have an input field. On focus a tooltip popups with a button that was added dynamically. How to make ng-click on that button working?</p>
  
  <p>I was looking for solutions, but there is no any clear concrete example.</p>
  
  <p>here is my plunkr: <a href="http://plnkr.co/edit/UFv6qcg68wD99HXf76xP?p=preview" rel="nofollow">http://plnkr.co/edit/UFv6qcg68wD99HXf76xP?p=preview</a></p>
  
  <p>Here is the code:</p>
  
  <pre><code>&lt;body&gt;
  
  &lt;div ng-controller="PopoverDemoCtrl"&gt;
      &lt;h4&gt;Dynamic&lt;/h4&gt;
  
      &lt;p&gt;{{message}}&lt;/p&gt;
  
      &lt;br&gt;&lt;button class="btn btn-warning" ng-click="removeMessage()"&gt;Remove mesage&lt;/button&gt;
  
      &lt;br&gt;&lt;br&gt;
      &lt;input type="text" value="Click me!" uib-popover-html="htmlPopover" popover-trigger="focus" class="form-control"&gt;
      popover-trigger="focus" class="form-control"&gt;--&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>controller</p>
  
  <pre><code>angular.module('ui.bootstrap.demo', ['ngAnimate', 'ui.bootstrap']);
  angular.module('ui.bootstrap.demo').controller('PopoverDemoCtrl', function ($scope, $sce) {
  
  $scope.dynamicPopover = {
      content: 'Hello, World!',
      templateUrl: 'myPopoverTemplate.html',
      title: 'Title'
  };
  
  $scope.message = '';
  
  $scope.showMessage = function(){
    console.log("Simple message");
    $scope.message = "Just added text";
  }
  
  $scope.removeMessage = function(){
    console.log("Simple message");
    $scope.message = "";
  }
  
  $scope.test = function(){
      console.log("test me click")
  }
  
  $scope.placement = {
      options: [
          'top',
          'top-left',
          'top-right',
          'bottom',
          'bottom-left',
          'bottom-right',
          'left',
          'left-top',
          'left-bottom',
          'right',
          'right-top',
          'right-bottom'
      ],
      selected: 'top'
  };
  
  $scope.htmlPopover = $sce.trustAsHtml('&lt;button ng-mousedown="test()"&gt;&lt;b style="color: red"&gt;Add message&lt;/b&gt;&lt;/button&gt; to the &lt;div class="label label-success"&gt;page&lt;/div&gt; content');
  </code></pre>
  
  <p>});</p>