title: UI Bootstrap Modal open programmatically
body: <p>I can open my UI Bootstrap Modal with a button but how do I open it within my Ctrl programmatically?</p>
  
  <p><strong>Plunker</strong>: <a href="http://plnkr.co/edit/Cdq2d9l1XxCi10bFXtBt?p=preview" rel="nofollow">http://plnkr.co/edit/Cdq2d9l1XxCi10bFXtBt?p=preview</a></p>
  
  <p>js:</p>
  
  <pre><code>  // open modal if this is true
    $scope.openModal = true;
  
    $scope.open = function (size) {
  
      var modalInstance = $uibModal.open({
        animation: $scope.animationsEnabled,
        templateUrl: 'myModalContent.html',
        controller: 'ModalInstanceCtrl',
        size: size,
        resolve: {
          items: function () {
            return $scope.items;
          }
        }
      });
  
      modalInstance.result.then(function (selectedItem) {
        $scope.selected = selectedItem;
      }, function () {
        $log.info('Modal dismissed at: ' + new Date());
      });
    };
  </code></pre>
  
  <p>html:</p>
  
  <pre><code>&lt;script type="text/ng-template" id="myModalContent.html"&gt;
      &lt;div class="modal-header"&gt;
          &lt;h3 class="modal-title"&gt;I'm a modal!&lt;/h3&gt;
      &lt;/div&gt;
      &lt;div class="modal-body"&gt;
          Modal body
      &lt;/div&gt;
      &lt;div class="modal-footer"&gt;
          &lt;button class="btn btn-primary" type="button" ng-click="ok()"&gt;OK&lt;/button&gt;
          &lt;button class="btn btn-warning" type="button" ng-click="cancel()"&gt;Cancel&lt;/button&gt;
      &lt;/div&gt;
  &lt;/script&gt;
  </code></pre>