Last active
August 29, 2015 13:56
-
-
Save xuyuanme/9032546 to your computer and use it in GitHub Desktop.
This file contains 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
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