Onclick bootstarp模式一次又一次地打开..在另一个div之上。
我要做的是 - 当用户点击按钮显示弹出... onclick或再次弹出不同弹出窗口然后再次打开..
我想破坏$ modal。
我正在使用角度引导程序。
我的unsaved-changes.html HTML -
<div class="modal-header">
</div>
<div class="modal-body">
<h4 class="text-center"><i class="fa fa-warning"></i> {{'unsavedChanges' | translate}}</h4>
<div class="row-fluid">
<span class="span4" ng-if="dashboardName!=='empty'">
{{changes}}
</span>
<div class="editor-row" ng-if="dashboardName==='empty'">
<form name="saveForm" ng-submit="save();dismiss();" novalidate>
<input class='input-medium' placeholder="empty" ng-model="$parent.$parent.unsavedtitle" type="text" ng-required="true" style="width:300px"/>
<button class="btn pull-right" ng-click="ignore();dismiss();">{{'ignore'| translate}}</button>
<button class="btn pull-right" ng-disabled="saveForm.$error.required" ng-if="($parent.$parent.unsavedtitle| lowercase)!=='empty'">{{'save'| translate}}</button>
<button class="btn pull-right" ng-disabled="true" ng-if="($parent.$parent.unsavedtitle| lowercase)==='empty'">{{'ignore' | translate}}</button>
</form>
</div>
<div class="modal-body" ng-if="dashboardName!=='empty'">
<button type="button" class="btn span2" ng-click="save();dismiss();">{{'save' | translate}}</button>
<button type="button" class="btn span2" ng-click="ignore();dismiss();">{{'ignore' | translate}}</button>
</div>
</div>
我的服务 -
this.init = function() {
self.check_unsaved_changes = config.unsaved_changes_warning;
$rootScope.$on("$locationChangeStart", function(event, next) {
if ((self.originalPath === $location.path()) || !self.check_unsaved_changes) {
return;
}
if (self.has_unsaved_changes()) {
event.preventDefault();
self.next = next;
$rootScope.unsavedtitle="";
$timeout(self.open_modal);
}
});
};
this.checkForUnsavedChanges = function(checkUnsavedChanges) {
self.check_unsaved_changes = checkUnsavedChanges;
};
this.open_modal = function() {
var confirmModal = $modal({
template: 'app/partials/unsaved-changes.html',
persist: true,
show: false,
scope: modalScope,
backdrop: 'static',
keyboard: false
});
$q.when(confirmModal).then(function(modalEl) {
modalEl.modal('show');
});
};