$('body').on('click', '#save-btn', function () {
$('#greetingsModal').modal('show');
});
<div id="greetingsModal" class="modal hide fade" tabindex="-1" role="dialog" aria- labelledby="myModalLabel" aria-hidden="true">
<div class="alert alert-success">
<a href="../admin/Supplier" class="close" data-dismiss="alert">x</a>
<strong>Well done!</strong>.
</div>
I want to display a popup message using the above styles whenever 'save-btn' is clicked. The above code works fine but there is a lot of time delay by doing it this way. Is there any way to display such a alert message using angular?
Bootrstrap-UI has pretty good alert. We can use the same place for all alerts. Just modify content.
HTML
<div class="alert alert-success" ng-show="showSuccessAlert">
<button type="button" class="close" data-ng-click="switchBool('showSuccessAlert')" >×</button>
<strong>Done!</strong> {{successTextAlert}}
</div>
JS
$scope.successTextAlert = "Some content";
$scope.showSuccessAlert = true;
....
// switch flag
$scope.switchBool = function(value) {
$scope[value] = !$scope[value];
};
Demo Fiddle
[EDIT]
if you interesting to put alert into dialog, here is other Demo in Plunker
I would be wary of mixing jQuery and Angular, it works but can get messy. You may be interested in the Bootstrap-UI Modal here: http://angular-ui.github.io/bootstrap/#/modal It can do what you want and more.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With