Skip to content

Instantly share code, notes, and snippets.

@xuyuanme
Last active August 29, 2015 13:56
Show Gist options
  • Save xuyuanme/9032546 to your computer and use it in GitHub Desktop.
Save xuyuanme/9032546 to your computer and use it in GitHub Desktop.
angular.module('app', ['alert-directive'])
.controller('AlertController', function ($scope) {
$scope.alerts = [
{ type: 'error', msg: 'Oh snap! Something went wrong.' },
{ type: 'success', msg: 'Well done! It worked out in the end.' }
];
$scope.addAlert = function () {
$scope.alerts.push({msg: "Watch out - another alert!"});
};
$scope.closeAlert = function (index) {
$scope.alerts.splice(index, 1);
};
})
// this is used to avoid confliction when compile blog with Jekyll
.config(function ($interpolateProvider) {
$interpolateProvider.startSymbol('{[{').endSymbol('}]}');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment