luisNotify

a service to display notifications using the angular-notify library and have a better alert and confirm methods

Features

A method config where you can set

Methods success, warning anderror taking message and details as arguments. the message will be displayed in the popup while both message and details will be logged in the browser console using $log

A method loading taking a ng.IPromise<string>, a message and a cancel function as arguments. Will display a notification with a spinner and the provided message.

Methods alert, andconfirm taking message, okLabel and cancelLabel as arguments. returns a ng.IPromise<boolean> that resolves with true if user clicked Ok and false if user clicked cancel, rejects if user clicked outside of the modal

Usage:

// to configure, needs to be done just once
angular.module("myApp").config(fumction(luisConfigProvider){
	luisConfigProvider.setConfig({
		parentTagIdClass: "demo",
		startTop: 60,
		prefix: "lui",
		canDismissConfim: true
	});
});

// to use in your controller
angular.controller("myCtrl", function(luisNotify) {
	luisNotify.error("your message", "some details");
	luisNotify.confirm("This action is irreversible, are you really sure you want to do it?", "Yes I am", "No i'm not")
	.then(function(isSure) {
		if (isSure) {
			var loadingDfd = $q.defer();
			luisNotify.loading(loadingDfd.promise, "doing the stuff");
			doTheStuff()
			.then( function() {
				loadingDfd.resolve("the stuff is done");
			}, function() {
				loadingDfd.reject("an error happened :'(");
			});
		}
	});
});

Notifications


Loading notification


Alerts and confirms

{{confirmationMessage}}