Fixes double evaluation of AngularJS in modal box

AngularJS syntax is evaluated twice in modal box after submitting form
which succeed and no redirection is going to be made. This commit fixes
this bevahiour by executing AngularJS code just after modal is created
and not every time it is going to be shown.

Change-Id: I204fce23ce52f74c38b7dc40ef03c6d5710ad254
Closes-Bug: #1371116
This commit is contained in:
Kamil Rykowski 2014-09-22 14:41:34 +02:00
parent 9f5156cf16
commit 31cdbe0981
1 changed files with 4 additions and 5 deletions

View File

@ -287,6 +287,7 @@ horizon.addInitFunction(function() {
});
horizon.modals.addModalInitFunction(horizon.datatables.validate_button);
horizon.modals.addModalInitFunction(horizon.utils.loadAngular);
// Load modals for ajax-modal links.
$(document).on('click', '.ajax-modal', function (evt) {
@ -341,14 +342,12 @@ horizon.addInitFunction(function() {
/* Manage the modal "stack" */
// When a new modal is opened, hide any that are already in the stack.
// After a modal has been shown, hide any other modals that are already in
// the stack. Only one modal can be visible at the same time.
$(document).on("show.bs.modal", ".modal", function () {
var container = $("#modal_wrapper"),
modal_stack = container.find(".modal"),
$this = $(this);
var modal_stack = $("#modal_wrapper .modal");
modal_stack.splice(modal_stack.length - 1, 1);
modal_stack.modal("hide");
horizon.utils.loadAngular(container);
});
// After a modal has been fully hidden, remove it to avoid confusion.