Last active
August 18, 2017 03:26
-
-
Save oozman/37dd20fcf69d2d495faf88377ba3cd6f to your computer and use it in GitHub Desktop.
ng-directive
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
/** | |
* Toast directive. Ex: <toast msg="Some message." style="success|info|warning|danger"></toast> | |
*/ | |
.directive('toast', [function () { | |
return { | |
restrict: 'E', | |
template: function (elem, attr) { | |
return '<div class="toast">\n' + | |
' <div class="{{ style }}" role="alert">{{msg}}</div>\n' + | |
'</div>'; | |
}, | |
scope: { | |
msg: '=msg', | |
style: '=style' | |
}, | |
link: function (scope, element, attrs) { | |
scope.style = 'alert alert-' + scope.style; | |
} | |
}; | |
}]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment