title: trigger modal popup from controller
body: <p>I have a bootstrap modal popup which I fill with data from my modalcontroller. After I filled it with data I would like to show it. To be able to show the modalpopup straight away when going into the page I would like to trigger it directly. Right now I have a button which does that, but how can I do it automatic in a proper way?</p>
  
  <pre><code>&lt;!-- Trigger the modal with a button --&gt;
  &lt;button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal"&gt;Open Modal&lt;/button&gt;
  
  &lt;!-- Modal --&gt;
  &lt;div id="myModal" class="modal fade" role="dialog" ng-init="getAllItems()"&gt;
      &lt;div class="modal-dialog"&gt;
  
          &lt;!-- Modal content--&gt;
          &lt;div class="modal-content"&gt;
              &lt;div class="modal-header"&gt;
                  &lt;button type="button" class="close" data-dismiss="modal"&gt;&amp;times;&lt;/button&gt;
                  &lt;h4 class="modal-title"&gt;Modal Header&lt;/h4&gt;
              &lt;/div&gt;
              &lt;div class="modal-body"&gt;
                  &lt;div class=""&gt;
                      &lt;form class="form-horizontal" name="form" role="form"&gt;
                          &lt;div ng-repeat="item in items"&gt;
                              &lt;input type="radio" name="fundselector" ng-model="item" ng-value="item"/&gt; {{item}} &lt;br /&gt;
                          &lt;/div&gt;
                      &lt;/form&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="modal-footer"&gt;
                  &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Close&lt;/button&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>My controller:</p>
  
  <pre><code>angular.module("Modal")
  .controller("ModalController",
  [
  "$scope", "$rootScope", "$location", "ModalService", "AuthenticationService",
  function ($scope, $rootScope, $location, ModalService, AuthenticationService) {
  
      AuthenticationService.GetCurrentWindowsUser(function(username) {
          $scope.username = username;
      });
  
      $scope.getAllItems = function () {
          AuthenticationService.GetCurrentWindowsUser(function (username) {
              if (username) {
                  AuthenticationService.GetItems(username, function (items) {
                      $scope.items = items;
                      //Trigger modalpopup here
                  });
              }
          });
      }
  }
  ]);
  </code></pre>