Html 启动警报框处于角度-空
我使用引导警报框显示成功消息。提交后带有消息的警报框显示得很完美,但问题是,提交前存在空警报框。Thnx。这是代码Html 启动警报框处于角度-空,html,angularjs,twitter-bootstrap,Html,Angularjs,Twitter Bootstrap,我使用引导警报框显示成功消息。提交后带有消息的警报框显示得很完美,但问题是,提交前存在空警报框。Thnx。这是代码 $scope.resetPassword = function () { var data = { email: $scope.resetPasswordEmail }; $http.post(serviceBase + 'aaaaaaaaaaaa', data).then(function (response
$scope.resetPassword = function () {
var data = {
email: $scope.resetPasswordEmail
};
$http.post(serviceBase + 'aaaaaaaaaaaa', data).then(function (response) {
$scope.successfullyReset = true;
$scope.message = "Email has been send successfully, you will be redicted to login page in 5 seconds.";
startTimer();
}, function (response) {
$scope.successfullyReset = false;
$scope.message = "Failed to send mail. There is no user with requested email";
});
};
这里有html代码
<div data-ng-hide="message == ''" data-ng-class="(successfullyReset) ? 'alert alert-success' : 'alert alert-danger'">
{{message}}
</div><br />
{{message}}
这是图片,这是提交前的外观
警报框从不隐藏,因为您在回调中定义了变量
消息
,您应该在控制器的开头定义它
$scope.message = '';
警告框永远不会隐藏,因为您在回调中定义了变量
message
,应该在控制器的开头定义它
$scope.message = '';
声明
$scope.message代码>第一个在$http
块之外
$scope.resetPassword = function () {
var data = {
email: $scope.resetPasswordEmail
};
$scope.message;
$http.post(serviceBase + 'aaaaaaaaaaaa', data).then(function (response) {
$scope.successfullyReset = true;
$scope.message = "Email has been send successfully, you will be redicted to login page in 5 seconds.";
startTimer();
}, function (response) {
$scope.successfullyReset = false;
$scope.message = "Failed to send mail. There is no user with requested email";
});
};
声明$scope.message代码>第一个在$http
块之外
$scope.resetPassword = function () {
var data = {
email: $scope.resetPasswordEmail
};
$scope.message;
$http.post(serviceBase + 'aaaaaaaaaaaa', data).then(function (response) {
$scope.successfullyReset = true;
$scope.message = "Email has been send successfully, you will be redicted to login page in 5 seconds.";
startTimer();
}, function (response) {
$scope.successfullyReset = false;
$scope.message = "Failed to send mail. There is no user with requested email";
});
};
没问题:)@ArterNo问题:)@Arter