嗨,我正在使用引导应用程序向导。当我第二次加载向导时,卡片没有初始化,内容也消失了。下面是我的密码。我使用的是引导3.3.5和jQuery2.1.4min版本。
在控制器中
var wizard = $('#some-wizard').wizard({});
$.fn.wizard.logging = true;
$event.preventDefault();
wizard.show();
wizard.on("submit", function(wizard){
$scope.agent = [];
console.log("Inside submit");
//console.log($scope.monitor);
$scope.agent.agentId = id;
$scope.agent.title = $("#title").val();
$scope.agent.desc = $("#description").val();
$scope.agent.userIds = $rootScope.tselected;
homeService.updateAgent($scope.agent).then(function(response) {
if(response.sucess == 'true'){
alert("success");
}
else {
alert("Failed");
}
});
wizard.submitSuccess();
wizard.hideButtons();
wizard.updateProgressBar(0);
});
console.log("Monitor edited" + id);
wizard.on('closed', function() {
$('.modal-backdrop').remove();
wizard.setActiveCard('card1');
});
wizard.el.find(".wizard-success .im-done").click(function() {
wizard.reset();
wizard.hide();
});
wizard.el.find(".wizard-success .create-another-server").click(function() {
wizard.reset();
});发布于 2015-08-18 15:13:34
我遇到了同样的问题。我也发现了这个:Bootstrap application wizard content dissapears,但它仍然让我有点困惑。
在对API做了更多修改之后,我能够使用前面的链接讨论的引用来修复这个问题。
//Initialize Wizard
var wizard = $("#environment-add-template").wizard(options);
//If the page is not refreshed, this maintains the reference for multiple environment adds
if (wizard._cards.length != 0) {
wizardReference(wizard);
} else {
wizard = wizardReference();
}我使用的是knockout.js,因此wizardReference (向导)与wizardReference=向导相同。此外,每当用户按下事件按钮来启动向导时,wizard._cards.length将等于您在html页面上有多少张卡片。如果用户不刷新页面,向导将再次初始化,但长度现在为零。引用只是将向导初始化回原来的卡片数量。
这将使原始值带回来。如果要重置值,则必须添加如下内容:
//When the user submits the data or closes the wizard, this reverts all values to original state
wizard.on("reset", function () {
wizard.modal.find(':input').val('').removeAttr('disabled');
wizard.modal.find(':select').val('').removeAttr('disabled');
wizard.modal.find(':textarea').val('').removeAttr('disabled');
});只需将wizard.reset()添加到关闭事件中即可。
https://stackoverflow.com/questions/31937041
复制相似问题