2016-06-15 16 views
1

成功メッセージを表示するためにブートストラップアラートボックスを使用します。メッセージが完全に表示されているアラートボックスを送信した後、問題がある、空のアラートボックスを送信する前にあります。 Thnx。ここでは、コードブートストラップ警報ボックス(角型)

$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 /> 

あるこの外観は前に enter image description here

答えて

3

は隠すことはありません、警告ボックスでは、内部変数のメッセージを定義するために提出する方法を画像であり、そのコールバックをコントローラの先頭に定義する必要があります。

$scope.message = ''; 
+0

男:) – Arter

+0

あなたは歓迎 – Karim

1

$httpブロック外$scope.message;最初の宣言します。あなたthnke

$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"; 

    }); 

}; 
+0

あります誰も – Arter

+0

問題ありませんthanke :) @Arter – CENT1PEDE

関連する問題