Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <html ng-app="notificationTest">
    <head>
        <title>Notification demo</title>
    </head>
    <body>
        <div class="container">
          <h1>Angular ui-notification demo</h1>
          <h3>Copied from <a href="https://github.com/alexcrack/angular-ui-notification" target="_blank"> here </a> </h3>
        </div>

        <div ng-controller="notificationController">
            <div class="container">
                <h3>Types of notifications</h3>
                <div class="btn-group-vertical">
                    <button class="btn btn-primary" ng-click="primary()">Primary Notification</button>
                    <button class="btn btn-danger" ng-click="error()">Error Notification</button>
                    <button class="btn btn-success" ng-click="success()">Success Notification</button>
                    <button class="btn btn-info" ng-click="info()">Information Notification</button>
                    <button class="btn btn-warning" ng-click="warning()">Warning Notification</button>
                </div>
            </div>

            <div class="container">
                <h3>Notification with title</h3>
                <div class="btn-group-vertical">
                    <button class="btn btn-primary" ng-click="primaryTitle()">Primary Notification</button>
                </div>
            </div>

            <div class="container">
                <h3>Custom show delay</h3>
                <div class="btn-group-vertical">
                    <button class="btn btn-danger" ng-click="errorTime()">Error Notification 1s</button>
                    <button class="btn btn-success" ng-click="successTime()">Success Notification 20s</button>
                </div>
            </div>

            <div class="container">
                <h3>Using html tags within message and title</h3>
                <div class="btn-group-vertical">
                    <button class="btn btn-danger" ng-click="errorHtml()">Error Notification</button>
                    <button class="btn btn-success" ng-click="successHtml()">Success Notification</button>
                </div>
            </div>
        </div>

 
  
    </body>
</html>
              
            
!

CSS

              
                /* Include this file in your html if you are using the CSP mode. */

[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak],
.ng-cloak, .x-ng-cloak,
.ng-hide {
  display: none !important;
}

ng\:form {
  display: block;
}

.ng-animate-block-transitions {
  transition:0s all!important;
  -webkit-transition:0s all!important;
}

/* show the element during a show/hide animation when the
 * animation is ongoing, but the .ng-hide class is active */
.ng-hide-add-active, .ng-hide-remove {
  display: block!important;
}


.ui-notification{position:fixed;z-index:9999;top:-100px;right:10px;width:300px;cursor:pointer;-webkit-transition:all ease .5s;-o-transition:all ease .5s;transition:all ease .5s;color:#fff;background:#428bca;box-shadow:5px 5px 10px rgba(0,0,0,.3)}.ui-notification.killed{-webkit-transition:opacity ease 1s;-o-transition:opacity ease 1s;transition:opacity ease 1s;opacity:0}.ui-notification>h3{font-size:14px;font-weight:700;display:block;margin:10px 10px 0;padding:0 0 5px;text-align:left;border-bottom:1px solid rgba(255,255,255,.3)}.ui-notification a{color:#fff}.ui-notification a:hover{text-decoration:underline}.ui-notification>.message{margin:10px}.ui-notification.warning{color:#fff;background:#f0ad4e}.ui-notification.error{color:#fff;background:#d9534f}.ui-notification.success{color:#fff;background:#5cb85c}.ui-notification.info{color:#fff;background:#5bc0de}.ui-notification:hover{opacity:.7}
              
            
!

JS

              
                angular.module("ui-notification", []), angular.module("ui-notification").value("uiNotificationTemplates", "angular-ui-notification.html"), angular.module("ui-notification").factory("Notification", ["$timeout", "uiNotificationTemplates", "$http", "$compile", "$templateCache", "$rootScope", "$injector", "$sce", function(t, e, i, n, a, o, s, c) {
  var r = 10,
    l = 10,
    u = 10,
    p = 10,
    d = 5e3,
    f = [],
    m = function(s, m) {
      "object" != typeof s && (s = {
        message: s
      }), s.template = s.template ? s.template : e, s.delay = angular.isUndefined(s.delay) ? d : s.delay, s.type = m ? m : "", i.get(s.template, {
        cache: a
      }).success(function(e) {
        var i = o.$new();
        if (i.message = c.trustAsHtml(s.message), i.title = c.trustAsHtml(s.title), i.t = s.type.substr(0, 1), i.delay = s.delay, "object" == typeof s.scope)
          for (var a in s.scope) i[a] = s.scope[a];
        var d = function() {
            for (var t = 0, e = 0, i = r, n = f.length - 1; n >= 0; n--) {
              var a = f[n],
                o = parseInt(a[0].offsetHeight),
                s = parseInt(a[0].offsetWidth);
              c + o > window.innerHeight && (i = r, e++, t = 0);
              var c = i + (0 === t ? 0 : u),
                d = l + e * (p + s);
              a.css("top", c + "px"), a.css("right", d + "px"), i = c + o, t++
            }
          },
          m = n(e)(i);
        m.addClass(s.type), m.bind("webkitTransitionEnd oTransitionEnd otransitionend transitionend msTransitionEnd click", function(t) {
          ("click" === t.type || "opacity" === t.propertyName && t.elapsedTime >= 1) && (m.remove(), f.splice(f.indexOf(m), 1), d())
        }), t(function() {
          m.addClass("killed")
        }, s.delay), angular.element(document.getElementsByTagName("body")).append(m), f.push(m), t(d)
      }).error(function(t) {
        throw new Error("Template (" + s.template + ") could not be loaded. " + t)
      })
    };
  return m.config = function(t) {
    r = t.top ? t.top : r, u = t.verticalSpacing ? t.verticalSpacing : u
  }, m.primary = function() {
    this(args, "")
  }, m.error = function(t) {
    this(t, "error")
  }, m.success = function(t) {
    this(t, "success")
  }, m.info = function(t) {
    this(t, "info")
  }, m.warning = function(t) {
    this(t, "warning")
  }, m
}]), angular.module("ui-notification").run(["$templateCache", function(t) {
  t.put("angular-ui-notification.html", '<div class="ui-notification"><h3 ng-show="title" ng-bind-html="title"></h3><div class="message" ng-bind-html="message"></div></div>')
}]);






//////////////////////////////////////////////////
//////////////////////////////////////////////////
//////////////////////////////////////////////////


 angular.module('notificationTest', ['ui-notification']);

            angular.module('notificationTest')

            .controller('notificationController', function($scope, Notification) {
                
                $scope.primary = function() {
                    Notification('Primary notification');
                };

                $scope.error = function() {
                    Notification.error('Error notification');
                };

                $scope.success = function() {
                    Notification.success('Success notification');
                };

                $scope.info = function() {
                    Notification.info('Information notification');
                };

                $scope.warning = function() {
                    Notification.warning('Warning notification');
                };

                // ==

                $scope.primaryTitle = function() {
                    Notification({message: 'Primary notification', title: 'Primary notification'});
                };

                // ==

                $scope.errorTime = function() {
                    Notification.error({message: 'Error notification 1s', delay: 1000});
                };

                $scope.successTime = function() {
                    Notification.success({message: 'Success notification 20s', delay: 20000});
                };

                // ==

                $scope.errorHtml = function() {
                    Notification.error({message: '<b>Error</b> <s>notification</s>', title: '<i>Html</i> <u>message</u>'});
                };

                $scope.successHtml = function() {
                    Notification.success({message: 'Success notification<br>Some other <b>content</b><br><a href="https://github.com/alexcrack/angular-ui-notification">This is a link</a><br><img src="https://angularjs.org/img/AngularJS-small.png">', title: 'Html content'});
                };
            });
              
            
!
999px

Console