我有一个 test01.html 页面。当我点击test01.html页面的“下一步”按钮时,他们调用一个Java服务,该服务返回一个key
,名称为changeList
,我只需使用下面的代码将此键值显示在test01.html页面中
{{::serviceErrorMsg}}
但问题是,当我第一次单击“下一步”按钮时,我的changeList
键值显示在我的HTML页面中是正确的,但是当我再次单击“下一步”按钮时,它会将旧值显示在该页面中,而我的键值已更改。
我的 test01.html 页面代码
<form name="profInfoForm" ng-submit="saveInfo(profInfoForm)" novalidate>
<div class="wrapper">
<div class="container">
<section class="main-ctr">
<div class="error-msg" ng-show="showErrorMsg">
<div class="text">
Please fix the validation error(s) below and try again.<br />
{{::serviceErrorMsg}}
</div>
</div>
<div ng-include="'views/header.html'"></div>
<main class="sm-main">
<section class="fix-section">
<h1>Professional information</h1>
<div class="lg-form">
<div class="form-group">
<label class="text-label lg-label">Test</label>
<div class="select-wrap lg-select">
<select class="form-input select" placeholder="Select Test"
ng-options="item.name as item.name for item in salutations"
ng-model="profInfo.test">
</select>
</div>
</div>
</div>
</section>
<div class="clear"></div>
<div class="button-ctr">
<button class="button"
ng-class="profInfoForm.$valid ? 'active' : 'disable'">
Next
</button>
</div>
</main>
</section>
</div>
</div>
</form>
我的app.controllers.js代码:
.controller('professionalInfoCtrl', ['$rootScope', '$scope', '$state', 'globalService', 'APP_CONSTANTS', 'dataServices', function ($rootScope, $scope, $state, globalService, APP_CONSTANTS, dataServices) {
$scope.showLoader = false;
$scope.selectedProfession = globalService.getProfessionalType();
var userData = globalService.getUserData();
$scope.saveInfo = function (formName) {
$scope.showErrorMsg = false;
$scope.formName = formName;
if ($scope.formName.$invalid) {
$scope.showErrorMsg = true;
return;
}
dataServices.verifyProfessionalInfo($scope.profInfo).then(function (res) {
$state.go(res.redirectURL);
}, function (res) {
$scope.showErrorMsg = true;
console.log(res.changeList);
$scope.serviceErrorMsg = res.changeList;
});
}
}]);
请帮我解决这个问题。
我将AngularJS v1.5.5
与Java Service
一起使用。