demo/bower_components/AngularJS-Toaster/toaster.js
function (scope, elm, attrs) {

            var id = 0,
                mergedConfig;

            mergedConfig = angular.extend({}, toasterConfig, scope.$eval(attrs.toasterOptions));

            scope.config = {
                position: mergedConfig['position-class'],
                title: mergedConfig['title-class'],
                message: mergedConfig['message-class'],
                tap: mergedConfig['tap-to-dismiss'],
                closeButton: mergedConfig['close-button']
            };

            scope.configureTimer = function configureTimer(toast) {
                var timeout = typeof (toast.timeout) == "number" ? toast.timeout : mergedConfig['time-out'];
                if (timeout > 0)
                    setTimeout(toast, timeout);
            };

            function addToast(toast) {
                toast.type = mergedConfig['icon-classes'][toast.type];
                if (!toast.type)
                    toast.type = mergedConfig['icon-class'];

                id++;
                angular.extend(toast, { id: id });

                // Set the toast.bodyOutputType to the default if it isn't set
                toast.bodyOutputType = toast.bodyOutputType || mergedConfig['body-output-type'];
                switch (toast.bodyOutputType) {
                    case 'trustedHtml':
                        toast.html = $sce.trustAsHtml(toast.body);
                        break;
                    case 'template':
                        toast.bodyTemplate = toast.body || mergedConfig['body-template'];
                        break;
                }

                scope.configureTimer(toast);

                if (mergedConfig['newest-on-top'] === true) {
                    scope.toasters.unshift(toast);
                    if (mergedConfig['limit'] > 0 && scope.toasters.length > mergedConfig['limit']) {
                        scope.toasters.pop();
                    }
                } else {
                    scope.toasters.push(toast);
                    if (mergedConfig['limit'] > 0 && scope.toasters.length > mergedConfig['limit']) {
                        scope.toasters.shift();
                    }
                }
            }

            function setTimeout(toast, time) {
                toast.timeout = $timeout(function () {
                    scope.removeToast(toast.id);
                }, time);
            }

            scope.toasters = [];
            scope.$on('toaster-newToast', function () {
                addToast(toaster.toast);
            });

            scope.$on('toaster-clearToasts', function () {
                scope.toasters.splice(0, scope.toasters.length);
            });
        }
function (scope, elm, attrs) {

            var id = 0,
                mergedConfig;

            mergedConfig = angular.extend({}, toasterConfig, scope.$eval(attrs.toasterOptions));

            scope.config = {
                position: mergedConfig['position-class'],
                title: mergedConfig['title-class'],
                message: mergedConfig['message-class'],
                tap: mergedConfig['tap-to-dismiss'],
                closeButton: mergedConfig['close-button']
            };

            scope.configureTimer = function configureTimer(toast) {
                var timeout = typeof (toast.timeout) == "number" ? toast.timeout : mergedConfig['time-out'];
                if (timeout > 0)
                    setTimeout(toast, timeout);
            };

            function addToast(toast) {
                toast.type = mergedConfig['icon-classes'][toast.type];
                if (!toast.type)
                    toast.type = mergedConfig['icon-class'];

                id++;
                angular.extend(toast, { id: id });

                // Set the toast.bodyOutputType to the default if it isn't set
                toast.bodyOutputType = toast.bodyOutputType || mergedConfig['body-output-type'];
                switch (toast.bodyOutputType) {
                    case 'trustedHtml':
                        toast.html = $sce.trustAsHtml(toast.body);
                        break;
                    case 'template':
                        toast.bodyTemplate = toast.body || mergedConfig['body-template'];
                        break;
                }

                scope.configureTimer(toast);

                if (mergedConfig['newest-on-top'] === true) {
                    scope.toasters.unshift(toast);
                    if (mergedConfig['limit'] > 0 && scope.toasters.length > mergedConfig['limit']) {
                        scope.toasters.pop();
                    }
                } else {
                    scope.toasters.push(toast);
                    if (mergedConfig['limit'] > 0 && scope.toasters.length > mergedConfig['limit']) {
                        scope.toasters.shift();
                    }
                }
            }

            function setTimeout(toast, time) {
                toast.timeout = $timeout(function () {
                    scope.removeToast(toast.id);
                }, time);
            }

            scope.toasters = [];
            scope.$on('toaster-newToast', function () {
                addToast(toaster.toast);
            });

            scope.$on('toaster-clearToasts', function () {
                scope.toasters.splice(0, scope.toasters.length);
            });
        }
function ( scope , elm , attrs ) { var id = 0 , mergedConfig ; mergedConfig = angular . extend ( { } , toasterConfig , scope . $eval ( attrs . toasterOptions ) ) ; scope . config = { position : mergedConfig [ 'position-class' ] , title : mergedConfig [ 'title-class' ] , message : mergedConfig [ 'message-class' ] , tap : mergedConfig [ 'tap-to-dismiss' ] , closeButton : mergedConfig [ 'close-button' ] } ; scope . configureTimer = function configureTimer ( toast ) { var timeout = typeof ( toast . timeout ) == "number" ? toast . timeout : mergedConfig [ 'time-out' ] ; if ( timeout > 0 ) setTimeout ( toast , timeout ) ; } ; function addToast ( toast ) { toast . type = mergedConfig [ 'icon-classes' ] [ toast . type ] ; if ( ! toast . type ) toast . type = mergedConfig [ 'icon-class' ] ; id ++ ; angular . extend ( toast , { id : id } ) ; // Set the toast.bodyOutputType to the default if it isn't set toast . bodyOutputType = toast . bodyOutputType || mergedConfig [ 'body-output-type' ] ; switch ( toast . bodyOutputType ) { case 'trustedHtml' : toast . html = $sce . trustAsHtml ( toast . body ) ; break ; case 'template' : toast . bodyTemplate = toast . body || mergedConfig [ 'body-template' ] ; break ; } scope . configureTimer ( toast ) ; if ( mergedConfig [ 'newest-on-top' ] === true ) { scope . toasters . unshift ( toast ) ; if ( mergedConfig [ 'limit' ] > 0 && scope . toasters . length > mergedConfig [ 'limit' ] ) { scope . toasters . pop ( ) ; } } else { scope . toasters . push ( toast ) ; if ( mergedConfig [ 'limit' ] > 0 && scope . toasters . length > mergedConfig [ 'limit' ] ) { scope . toasters . shift ( ) ; } } } function setTimeout ( toast , time ) { toast . timeout = $timeout ( function ( ) { scope . removeToast ( toast . id ) ; } , time ) ; } scope . toasters = [ ] ; scope . $on ( 'toaster-newToast' , function ( ) { addToast ( toaster . toast ) ; } ) ; scope . $on ( 'toaster-clearToasts' , function ( ) { scope . toasters . splice ( 0 , scope . toasters . length ) ; } ) ; }
creates an internal scope for this directive
creates an internal scope for this directive