npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@flexem/ng-notifications-bar

v1.0.0

Published

Angular.js component for stylish and flexible application notifications.

Downloads

7

Readme

ng-notifications-bar

Angular.js and Animate.css based component for stylish and flexible application notifications.

Demo

Overview

Web applications requires notify users of ongoing events. Common cases are errors, successful completion notifications etc. With ng-notifications-bar it's as easy as,

<body>
	<notifications-bar class="notifications"></notifications-bar>
	...

Installation

Npm installation,

$ npm install ng-notifications-bar --save

Or bower installation,

$ bower install ng-notifications-bar --save

Update your scripts and styles section or use the require for browserified applications.

<link rel="stylesheet" href="bower_components/ng-notifications-bar/dist/ngNotificationsBar.min.css" />
<script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
<script src="bower_components/ng-notifications-bar/dist/ngNotificationsBar.min.js"></script>

If you use Grunt, wiredep should inject the required angular-sanitize.js for you.

For browserify applications, require module in yours application module,

require('ng-notifications-bar');

In case you are using sass in project, it's possible to just import ngNotificationsBar styles,

@import "../../node_modules/ng-notifications-bar/sass/ngNotificationsBar";

In application module,

angular.module('app', ['ngNotificationsBar', 'ngSanitize']);

ngSanitize can be omitted if HTML support isn't needed.

API

The module consists of there elements - directive, service and provider.

Directive

notifications-bar element directive, should be placed once, typically right after <body> open tag.

<notifications-bar class="notifications"></notifications-bar>

If you are using a icon library besides Glyphicons for the close button (such as Font Awesome), include a closeIcon attribute.

<notifications-bar class="notifications" closeIcon="fa fa-times-circle"></notifications-bar>

The default is the glyphicon-remove icon so don't forget to import Glyphicons if you aren't defining a closeIcon attribute.

Possible to use as attribute, as well

<div notifications-bar class="notifications"></div notifications-bar>

Service

notification service is used by controllers (or other directives), to show notifications.

app.controllers('app', function ($scope, api, notifications) {
	api.get({resource: 'tasks'})
		.then(function (tasks) {
			$scope.tasks = tasks;
		}, function (error) {
			notifications.showError({message: error.message});
		});

	$scope.submitTask = function () {
		api.post({resource: 'tasks'}, {description: this.description})
			.then(function () {
				notifications.showSuccess({message: 'Your task posted successfully'});
			}, function (error) {
				notifications.showError({message: 'Oh no! Task submission failed, <em>please try again.</em>'});
			});
	}
});

Provider

notificationsConfigProvider is used to override some notifications bar defaults.

app.config(['notificationsConfigProvider', function (notificationsConfigProvider) {
	// auto hide
	notificationsConfigProvider.setAutoHide(true)

	// delay before hide
	notificationsConfigProvider.setHideDelay(3000)
}])

Settings

It is possible to setup the whole notifications bar module in module config and each notification separately in controller

Available options:

  • autoHide
  • hideDelay
  • acceptHTML
  • autoHideAnimation
  • autoHideAniationDelay

Please note, HTML support is only configurable at a global level. If HTML is to be supported, make sure to inject the 'ngSanitize' dependency.

var app = angular.module('app', ['ngNotificationsBar', 'ngSanitize']);

During configuration

app.config(['notificationsConfigProvider'], function (notificationsConfigProvider) {
	// auto hide
	notificationsConfigProvider.setAutoHide(true);

	// delay before hide
	notificationsConfigProvider.setHideDelay(3000);

	// support HTML
	notificationsConfigProvider.setAcceptHTML(false);
	
	// Set an animation for hiding the notification
	notificationsConfigProvider.setAutoHideAnimation('fadeOutNotifications');
	
	// delay between animation and removing the nofitication
	notificationsConfigProvider.setAutoHideAnimationDelay(1200);
	
}])

Override in controller

app.controller('main', function ($scope, notifications) {
	$scope.showError = function () {
		notifications.showError({
			message: 'Oops! Something bad just happened! (hides faster)',
			hideDelay: 1500, //ms
			hide: true //bool
		});
	};
});

Development

Install bower dependencies,

$ bower install

Install npm dependencies,

$ npm install

Run grunt build,

$ grunt

as result, /dist folder is created with ready to use .js and .css file.

Project doesn't have tests at the moment, so run example and check the functionality,

$ grunt start:example

Licence

Copyright (c) 2014, [email protected]

MIT