title: AngularJS UI Bootstrap dismiss() won´t work
body: <p>Let me start by saying that I am very new to angular.
  I have tried to setup a modal ui which works fine. But when I click the "cancel" button on the interface nothing happens.</p>
  
  <p>This is my code:</p>
  
  <pre><code>    (function () {
          var domainName = 'TournamentCategory';
          angular.module('tournamentCategories').controller("CategoriesController",
          ['$scope', '$modal', 'guidGenerator', 'eventBus', domainName + "Service",                    
          'TournamentCategoryModelFactory',
          function ($scope, $modal, guidGenerator, eventBus, domainService, modelFactory)  
          {$scope.openTournamentTree = function () {
  
  
          var modalInstance = $modal.open({
              templateUrl: 'TournamentTreeModal.html',
              controller: 'TreeController',
              size: 'wide-90',
              resolve: {
  
              }
          });
  
          modalInstance.result.then(function (selectedItem) {
              //$scope.selected = selectedItem;
          }, function () {
              //$log.info('Modal dismissed at: ' + new Date());
          });
          };
  
          $scope.ok = function () {
          modalInstance.close();
          }
  
          $scope.cancel = function () {
          modalInstance.dismiss('cancel');
          };
          }]);
      })();
  </code></pre>
  
  <p>The HTML:</p>
  
  <pre><code>&lt;script type="text/ng-template" id="TournamentTreeModal.html"&gt;
  &lt;div class="modal-header"&gt;
  &lt;/div&gt;
  &lt;div class="modal-body"&gt;
      &lt;div class="include-tree" ng-include="'tournament-tree.html'"&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="modal-footer"&gt;
      &lt;button class="btn btn-primary" ng-click="ok()"&gt;GEM&lt;/button&gt;
      &lt;button ng-click="cancel()" class="btn btn-warning" type="button" data-dismiss="modal"&gt;LUK, uden at gemme&lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>This is my "treeController"</p>
  
  <pre><code>angular.module('tournamentTree').controller("TreeController", ['$scope', 'guidGenerator', function ($scope, guidGenerator) {
  $scope.allMatches = [];
  $scope.finalMatch = [createNewMatch()];
  $scope.tierCount = 1;
  $scope.previousMatchTier = 0;
  
  $scope.deletePreviousMatches = function (parentMatch) {
      for (var i in parentMatch.previousMatches) {
          var previousMatch = parentMatch.previousMatches[i];
          _.remove($scope.allMatches, function (match) { return match.id == previousMatch.id });
      }
      parentMatch.previousMatches = [];
  }
  
  
  $scope.addMatches = function (thisMatch) {
      if (thisMatch &amp;&amp; !thisMatch.previousMatches)
          thisMatch.previousMatches = [];
      if (thisMatch &amp;&amp; thisMatch.previousMatches.length == 0) {
          thisMatch.previousMatches.push(createNewMatch(thisMatch));
          thisMatch.previousMatches.push(createNewMatch(thisMatch));
      }
  }
  
  $scope.addMatchTier = function () {
          for (var i in $scope.allMatches) {
              var match = $scope.allMatches[i];
              if (match.previousMatches.length == 0) {
                  $scope.addMatches(match);
              }
  
          }
          $scope.tierCount++;
  }
  
  $scope.previousMatchTier = function () {
      for (var i in $scope.allMatches) {
          var previous;
          if (previous.allMatches.length == i) {
              previous = $scope.allMatches[i] - $scope.allMatches[i - 1];
          }
      }
  }
  
  $scope.removeMatchTier = function () {
      //if (confirm('Er du sikker på, at du vil slette det yderste niveau af turneringstræet?')) {
      var matchesToDelete = [];
      for (var i in $scope.allMatches) {
          var match = $scope.allMatches[i];
          if (match.previousMatches.length == 0) {
              matchesToDelete.push(match.nextMatch);
              //$scope.deletePreviousMatches(match.nextMatch);
          }
      }
  
      for (var i in matchesToDelete) {
          $scope.deletePreviousMatches(matchesToDelete[i]);
      }
      $scope.tierCount--;
      //}
  }
  
  $scope.hasPreviousMatches = function (match) {
      return match &amp;&amp; match.previousMatches &amp;&amp; match.previousMatches.length &gt; 0;
  }
  
  $scope.moveWinnerToNextMatch = function (match, winnerName) {
      match.nextMatch.setPlayerName(match.id, winnerName);
  }
  
  function createNewMatch(nextMatch) {
      var newMatch = {};
      newMatch.tier = nextMatch &amp;&amp; nextMatch.tier ? nextMatch.tier + 1 : 1;
      newMatch.id = guidGenerator.newGuid();
      newMatch.player1 = "";
      newMatch.player2 = "";
      newMatch.nextMatch = nextMatch;
      newMatch.previousMatches = [];
      newMatch.setPlayerName = function(matchId, playerName) {
          for (var i in newMatch.previousMatches)
          {
              if (newMatch.previousMatches[i].id == matchId)
              {
                  if (i == 0)
                      newMatch.player1 = playerName;
                  else
                      newMatch.player2 = playerName;
              }
          }
      }
  
      $scope.allMatches.push(newMatch);
      return newMatch;
  }
  }]);
  </code></pre>