pyc-website

main website for pyc inc.

git clone https://9o.is/git/pyc-website.git

commit 97a4e067d860392af5e5659e6c3f7faff5316638
parent a506de9746b1d473909b15d9aabdc717d367a630
Author: Jul <jul@9o.is>
Date:   Sun,  4 May 2014 06:31:14 -0400

clear alert box during ajax page change

Diffstat:
Msrc/main/webapp/app/App.js | 10++++++++++
1 file changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/main/webapp/app/App.js b/src/main/webapp/app/App.js @@ -15,6 +15,8 @@ app.run(["$rootScope", "$window", "$state", "$stateParams", function ($rootScope event.preventDefault(); $window.location.href = '/logout'; } + + $rootScope.$broadcast('alertClear'); }); $rootScope.$state = $state; @@ -62,6 +64,10 @@ app.controller('AlertCtrl', ['$scope', function($scope) { $scope.addAlert(alert); }); + $scope.$on('alertClear', function() { + $scope.clearAlerts(); + }); + $scope.addAlert = function(alert) { $scope.alerts = []; $scope.alerts.push({type: alert.msg_type, msg: alert.msg}); @@ -70,6 +76,10 @@ app.controller('AlertCtrl', ['$scope', function($scope) { $scope.closeAlert = function(index) { $scope.alerts.splice(index, 1); }; + + $scope.clearAlerts = function() { + $scope.alerts = []; + }; }]); app.controller('FormCtrl', ['$scope', function($scope) {