GithubHelp home page GithubHelp logo

rachoor / angular-notifier Goto Github PK

View Code? Open in Web Editor NEW

This project forked from l-lin/angular-notifier

0.0 1.0 0.0 853 KB

AngularJS simple notifications service

Home Page: http://l-lin.github.io/angular-notifier/

License: MIT License

JavaScript 83.83% CSS 12.97% HTML 3.19%

angular-notifier's Introduction

Angular Notifier Build Status Built with Grunt

AngularJS simple notifications service

Live demo

See demo

Getting started

Dependencies

The only required dependencies are:

Download

Manually

The files can be downloaded from:

  • Minified JS and CSS for production usage
  • Un-minified JS and CSS for development

With BowerJS

$ bower install angular-notifier

Installation

Include the JS and CSS file in your index.html file:

<link rel="stylesheet" href="angular-notifier.min.css">
<script src="angular-notifier.min.js"></script>

Declare dependencies on your module app like this:

angular.module('myModule', ['llNotifier']);

Usage

Simple usage

Inject the notifier service and notify by supplying with a String as a parameter like this:

app.controller('demoCtrl', function($scope, notifier) {
    $scope.demoText = 'foobar';
    $scope.notify = function() {
        notifier.notify($scope.demoText);
    };
});

Custom notifications

Inject the notifier service and notify by supplying with a config Object as a parameter like this:

app.controller('demoCtrl', function($scope, notifier) {
    $scope.demoNotification = {
        template: 'Custom notification',
        hasDelay: true,
        delay: 3000,
        type: 'info',
        position: 'top center'
    };
    $scope.customNotify = function() {
        notifier.notify($scope.demoNotification);
    };
});

Defining your own scope

You can put your own scope in the config object like this:

app.controller('demoCtrl', function($scope, notifier) {
    var notification = {
        template: '<h3 ng-click="openNestedNotification()">Click me!</h3>',
        scope: {
            openNestedNotification: function() {
                notifier.notify({template: 'I am a nested notification!', type: 'success'});
            }
        },
        hasDelay: false
    };
    $scope.nestedNotification = function() {
        notifier.notify(notification);
    };
});

License

MIT License

angular-notifier's People

Contributors

jashmenn avatar l-lin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.