title: window.close how to close the current window in angular
body: <p>hi this is my current code where i have popup once i cancel the popup i have to close the entire app tab which means the window </p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html ng-app="plunker"&gt;
    &lt;head&gt;
      &lt;script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.11/angular.js"&gt;&lt;/script&gt;
      &lt;script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.10.0.js"&gt;&lt;/script&gt;
      &lt;script src="example.js"&gt;&lt;/script&gt;
      &lt;link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet"&gt;
    &lt;/head&gt;
    &lt;body&gt;
  
      &lt;script&gt;
        angular.module('plunker', ['ui.bootstrap']);
        var ModalDemoCtrl = function ($scope, $modal, $log) {
  
            /* Note: The hard coded user object has been commented out, as 
               it is now passed as an object parameter from the HTML template.
            */
            /* $scope.user = {
                user: 'name',
                password: null
            };*/
  
            $scope.open = function (user) {
                $scope.user = user;
                $modal.open({
                    templateUrl: 'myModalContent.html',
                    backdrop: true,
                    windowClass: 'modal',
                    controller: function ($scope, $modalInstance, $log, user) {
                        $scope.user = user;
                        $scope.submit = function () {
                            $log.log('Submiting user info.');
                            $log.log(JSON.stringify(user));
                            $modalInstance.dismiss('cancel');
                        }
                        $scope.cancel = function () {
                            $modalInstance.dismiss('cancel');
                           window.open('location', '_self', '');
                          window.close();
                        };
                    },
                    resolve: {
                        user: function () {
                            return $scope.user;
                        }
                    }
                });
            };
        };  
    &lt;/script&gt;
  
    &lt;div ng-controller="ModalDemoCtrl"&gt;
        &lt;script type="text/ng-template" id="myModalContent.html"&gt;
            &lt;div class="modal-header"&gt;
                &lt;h3&gt;I'm a modal!&lt;/h3&gt;
            &lt;/div&gt;
            &lt;form ng-submit="submit()"&gt;
              &lt;div class="modal-body"&gt;
                &lt;label&gt;User name&lt;/label&gt;
                &lt;input type="text" ng-model="user.user" /&gt;
                &lt;label&gt;Password&lt;/label&gt;
                &lt;input type="password" ng-model="user.password" /&gt;
              &lt;/div&gt;
              &lt;div class="modal-footer"&gt;
                  &lt;button class="btn btn-warning" ng-click="cancel()"&gt;Cancel&lt;/button&gt;
                  &lt;input type="submit" class="btn primary-btn" value="Submit" /&gt;
              &lt;/div&gt;
            &lt;/form&gt;
        &lt;/script&gt;
  
        &lt;button class="btn" ng-click="open({user: 'username', password: 'password'})"&gt;Open me!&lt;/button&gt;
        &lt;div ng-show="user.password"&gt;Got back from modal: {{ user | json}}&lt;/div&gt;
    &lt;/div&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>this code not working any help please</p>
  
  <p>window.close() not working</p>