Sha256: b08aeedb23c16dd20a637e8665a263b62f6891d4316b39b1fabc13094f46bff1
Contents?: true
Size: 1.11 KB
Versions: 30
Compression:
Stored size: 1.11 KB
Contents
module = angular.module('maestrano.components.mno-flash-msg',[]) #============================================ # Component 'Flash Msg' #============================================ module.controller('MnoFlashMsgCtrl',[ '$scope', 'MsgBus', ($scope, MsgBus) -> # Message bus connection $scope.errors = MsgBus.subscribe('errors') # Only show the flash message if # there are errors in the pipe $scope.isFlashShown = () -> $scope.errors().length > 0 # Empty the errors array in the MsgBus $scope.closeFlash = () -> MsgBus.publish('errors',[]) ]) module.directive('mnoFlashMsg', ['TemplatePath', (TemplatePath) -> return { restrict: 'A' scope: {} controller: 'MnoFlashMsgCtrl' template: ' <div class="alert alert-error alert-top fade" ng-class="isFlashShown() && \'in\'"> <button class="close" ng-click="closeFlash()">×</button> <strong>Snap! This action couldn\'t be performed.</strong> <ul> <li ng-repeat="error in errors()"> {{error}} </li> </ul> </div>' } ])
Version data entries
30 entries across 30 versions & 1 rubygems