long pham
long pham

Reputation: 37

how to close modal and redirective contemporary

I want to close modal and redirective to another link, but my modal is faded but not hiden, and redirect is ok. this is my code

code angularjs

$scope.closeModalAndRedrect = function(url) {
  $window.location.href = url;
  angular.element("#myModal").modal("toggle");

}

code html

  <!-- Modal content-->
  <div class="modal-content">
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal">&times;</button>
      <h2 class="modal-title">project details</h2>
    </div>
    <div class="modal-body">
      <!-- <p>Some text in the modal.</p> -->


      <div class="row">
        <div class="col-md-6">
          <b>timesheet</b>

        </div>
        <div class="col-md-6">
          <a ng-click="closeModalAndRedrect('#!reporttimesheet')">timesheet</a>
        </div>
      </div>
      <hr>
    </div>
    <div class="modal-footer">
      <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
    </div>
  </div>

</div>

it redirectived but modal is not hiden

Upvotes: 0

Views: 20

Answers (1)

Pyae Phyoe Shein
Pyae Phyoe Shein

Reputation: 13807

$scope.closeModalAndRedrect = function(url) {
    $('#myModal').on('shown.bs.modal', function () {
        $(".modal-backdrop.in").hide();
    })
    angular.element("#myModal").dialog("close");
    $window.location.href = url;
}

Upvotes: 1

Related Questions