How to showa bootstrap alert inside anguularjs post method

Aug 2 2017 3:02 AM
Hi,
 
This is my angularjs controller... 
 
///
var app = angular.module("Homeapp", []);
app.controller("HomeController", function ($scope, $http) {
$scope.btnText = "Save";
$scope.savedata = function () {
$scope.btnText = "Plz Wait !";
debugger;
$http({
method: 'POST',
url: '/Home/Register',
data: $scope.register
}).then(function (success){
$scope.register = null;
$scope.btnText = "Save";
//alert('Data Registered');
$scope.IsVisible = true;
},function (error){
alert('Faild');
});
}
});
 
 
 
======================= 
 
<div class="alert alert-success alert-dismissable"  id="success-alert">
Success<button type="button" class="close" data-dismiss="alert" alial-label="close">x</button>
</div>
 
 
==================== 
 
I want to show the bootstrap alert message when the data will be sucessfully saved insted of normal alert method.... 
 
 
for success....    class=alert-success 
for faild   .....      class= alert-danger ...
 
 
 
===============================Can any one tell me plz.............. 

Answers (2)