Created
April 29, 2014 21:00
-
-
Save adasq/885b0a97cf26f898959e to your computer and use it in GitHub Desktop.
ANGULAR JS ALERT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var AlertManager = function(){ | |
var template = '<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>'; | |
this.setText = function(type, text){ | |
$scope.alert = {text: $sce.trustAsHtml(template+text), type: (type || 'danger')}; | |
}; | |
this.setDangerAlert = function(text){ | |
this.setText('danger',text); | |
}; | |
this.setSuccessAlert = function(text){ | |
this.setText('success',text); | |
}; | |
this.hide = function(){ | |
$scope.alert = null; | |
} | |
}; | |
var alert = new AlertManager(); | |
alert.setSuccessAlert("<a href='sss'>xdddda aq q qqqqqqqqqqqqqq dddddddddddddddddddddddddddddddddddddddddddd"+ | |
"ssssssssssssssssssssssssss ssssssssssssssssssssssss aaaaaaaaaaaaaaaaaaaaaaaaaaa"+ | |
"</a>"); | |
<div ng-show="alert" ng-bind-html="alert.text" class="alert" ng-class="{'alert-{{alert.type || 'warning'}}': true, 'alert-dismissable': true}"> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment