How to use controller on modal in ionic framework

I have a menu on header and it opened when it will be clicked and it is defined in index.html and LoginCtrl. When i clicked on menu button menu modal opened but when i clicked on close button inside menu then nothing is heppend.Even i have also defined closeModal in LoginCtrl.I am using ionic framework. Or is there another way to define it or share controller. This is index file:

<ion-header-bar align-title="center" class="col-xs-12 col-sm-12 header  pd-N">
  <div class="col-xs-12 col-sm-12 pd-N m-N" >
  <div class="col-xs-3 col-sm-3 m-N menu-btn pdLR" ng-controller="LoginCtrl">
    <button type="button" class="navbar-toggle collapsed pull-left" ng-click="openModal(1)">
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
  </button>
  </div>
</div>
</ion-header-bar>
<ion-nav-view animation="slide-left-right"></ion-nav-view>
<div ng-controller="LoginCtrl">
  <script id="menu.html" type="text/ng-template">
    <div class="col-xs-10 col-sm-10 col-xs-offset-1 col-sm-offset-1 menu-open menu-block bdr">
      <p class="col-xs-12 col-sm-12 pd-N">
        <span class="glyphicon glyphicon-remove remove-btn" ng-click="closeModal(1)"></span></p>
      <h4 class="col-xs-12 col-sm-12 text-center pd-N"><span class="text-menu">Menu</span></h4>
      <ul class="nav navbar-nav">
        <li class="active"><a title="" ng-click="#/tab/"> Home</a></li>
        <li><a href="" title=""> Sort by: Prospects</a></li>
        <li><a href="" title=""> Sort by: Referral Sources</a></li>
        <li><a href="" title=""> Sort by: Clients</a></li>
        <li><a href="" title=""> Sort by: Due Date</a></li>
        <li><a href="" title=""> Sort by: Alphabetical</a></li>
        <li><a href="" title="" ng-click="myAccount()"> My Account</a></li>
        <li><a href="" title=""> Log Out</a></li>
      </ul>
    </div>
  </script>
</div>

This is my Controller:

define(function () {
'use strict';

function ctrl($scope, $http, $state, $ionicModal) {
$scope.showLoading = false;
$scope.hideLogin = false;
$scope.showMenu = false;
$scope.errorMessage = false;
$scope.showMenu = false;

$ionicModal.fromTemplateUrl('menu.html', {
  id: '2', // We need to use and ID to identify the modal that is firing the event!
  scope: $scope,
  animation: 'fade-in'
}).then(function(modal) {
  $scope.oModal2 = modal;
});

$scope.openModal = function(index) {
  $scope.oModal2.show();
};

$scope.closeModal = function(index) {console.log('here');
  $scope.oModal2.hide();
};
};
ctrl.$inject = ['$scope', '$http', '$state', '$ionicModal'];
return ctrl;

})(window.angular);