我有一个带有保存按钮的表格。单击“保存”按钮后,将调用保存功能,所有表单数据将被保存并移至其他页面。然后,当我转到上一页时,选项卡按钮停止工作。使选项卡按钮起作用的唯一方法是刷新页面。
我曾经尝试过给tabindex,但是仍然面临同样的问题。
这是我的代码:
<div id="customeruser" ng-show="custom_user">
<form name="userForm">
<ul class="collapsible" data-collapsible="accordion">
<li>
<div class="collapsible-header active left">
<i class="material-icons tclose">add</i>
<i class="material-icons topen">remove</i>
Personal Information
</div>
<div class="collapsible-body">
<div class="row">
<div>
<input id="first_name" type="text" class="validate" ng-model="user.first_name">
<label for="first_name">First Name</label>
</div>
<div>
<input class="passhints" name="password" ng-model="user.password" id="password"
type="password" autocomplete="new-password">
<label for="password" data-error="wrong" data-success="right">Password*</label>
</div>
</div>
</div>
</li>
<li>
<div class="collapsible-header left">
<i class="material-icons tclose">add</i>
<i class="material-icons topen">remove</i>
Other information
</div>
<div>
<input id="last_name" type="text" class="validate" ng-model="user.last_name">
<label for="first_name">Last Name</label>
</div>
</li>
</ul>
<div class="left" ng-show="custom_user">
<button type="submit" id="savechanges" ng-click="saveUser()">Create</button>
</div>
</form>
Controller.js
$scope.saveUser = function () {
Restangular.all("users/createuser/").post($scope.user).then(
function (user_status) {
$scope.user.id = user_status
if (user_status > 0) {
swal({
title: "Success!",
text: "User was successfully created!",
type: "success",
confirmButtonText: "OK"
},
function (isConfirm) {
if (isConfirm) {
$state.go('manage');
}
});
}
},
)
}