Giter VIP home page Giter VIP logo

angular-growl-2's Introduction

#angular-growl-2 Growl like notifications for angularJS projects, using bootstrap alert classes, originally developed by Marco Rinck and Jan Stevens

##Features

Standard bootstrap 2.x styles

  • growl like notifications like in MacOS X
  • using standard bootstrap classes (alert, alert-info, alert-error, alert-success)
  • global or per message configuration of a timeout when message will be automatically closed
  • automatic translation of messages if angular-translate filter is present, you only have to provide keys as messages, angular-translate will translate them
  • pre-defined $http-Interceptor to automatically handle $http responses for server-sent messages
  • automatic CSS animations when adding/closing notifications (only when using >= angularJS 1.2)
  • < 1 kB after GZIP

##Changelog

0.4.0 - 19th Nov 2013

  • updated dependency to angularJS 1.2.x, angular-growl does not work with 1.0.x anymore (BREAKING CHANGE)
  • new option: only display unique messages, which is the new default, disable to allow same message more than once (BREAKING CHANGE)
  • new option: allow html tags in messages, default is off, allows to use HTML tags in messages

0.3.1 - 1st Oct 2013

  • bugfix: translating of messages works again
  • change: also set alert css classes introduced by bootstrap 3

0.3.0 - 26th Sept 2013

  • adding css animations support via ngAnimate (for angularJS >= 1.2)
  • ability to configure server message keys

##Installation

You can install angular-growl-v2 with bower:

bower install angular-growl-v2

Alternatively you can download the files in the build folder manually and include them in your project.

<html>
  <head>
    <link href="bootstrap.min.css" rel="stylesheet">
    <script src="angular.min.js"></script>

    <link href="angular-growl.css" rel="stylesheet">
    <script src="angular-growl.js"></script>
  </head>
</html>

As angular-growl is based on its own angularJS module, you have to alter your dependency list when creating your application module:

var app = angular.module('myApp', ['angular-growl']);

Finally, you have to include the directive somewhere in your HTML like this:

<body>
    <div growl></div>
</body>

##Usage

Just let angular inject the growl Factory into your code and call the 4 functions that the factory provides accordingly:

app.controller("demoCtrl", ['$scope', 'growl', function($scope, growl) {
  $scope.addSpecialWarnMessage = function() {
    growl.warning("This adds a warn message");
    growl.info("This adds a info message");
    growl.success("This adds a success message");
    growl.error("This adds a error message");
  }
}]);

The title must be set as a configuration parameter:

app.controller("demoCtrl", ['$scope', 'growl', function($scope, growl) {
  $scope.addSpecialWarnMessage = function() {
    growl.warning("This adds a warn message", {title: 'Warning!'});
    growl.info("This adds a info message", {title: 'Random Information'});
    growl.success("This adds a success message"); //no title here
    growl.error("This adds a error message", {title: 'ALERT WE GOT ERROR'});
  }
}]);

If angular-translate is present, its filter is automatically called for translating of messages, so you have to provide only the key:

app.controller("demoCtrl", ['$scope', 'growl', function($scope, growl) {
  $scope.addSpecialWarnMessage = function() {
      growl.success("SAVE_SUCCESS_MESSAGE");
      growl.error("VALIDATION_ERROR");
  }
}]);

Configuration/Documentation/Info

For the configuration options, documentation and live examples visit the github pages:

Live demo's can be found on the following codepen collection:

This stops messages from closing when mouse is over:

app.config(['growlProvider', function (growlProvider) {
  growlProvider.globalPauseOnMouseOver(true);
}]);

Contributions

  • Fork the project
  • Change/Fix/Add the stuff you want
  • Clone the codepens that have effect on your changes or if you add new features create a codepen that show them
  • Create a PR
  • Don't forget to add your name to the Thanks section!

Thanks

Thanks Marco Rinck for the original code, the following people have contributed to this project:

License

Copyright (C) 2015 Marco Rinck

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

angular-growl-2's People

Contributors

alextm84 avatar anaphase avatar aryeh avatar asabirov avatar bchatelard avatar brunoporto avatar conder avatar diosney avatar flaviocysne avatar flippinjoe avatar fmenezes avatar gandaldf avatar janstevens avatar madhead avatar marcorinck avatar milosmosovsky avatar mrngoitall avatar naveenparakadan avatar ondram avatar pgaertig avatar piu130 avatar royerboat avatar schoes avatar soumya92 avatar starf avatar swilvan avatar tlvince avatar vik-singh avatar wardvijf avatar willjk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

angular-growl-2's Issues

Cannot read property 'success' of undefined

I use growl somewhere like this:

function showErrorMessage(message) {
growl.error('Error:' + message, {ttl: 5000});
}

I inject growl in the good place. But i get this:

TypeError: Cannot read property 'success' of undefined

injecting interpolation is not possible

First of all, tnx for the hard work!

Your translate call however does not allow interpolation injection. So changing

translate(message.text, message.variables)

to

translate(message.text, message.variables, message.interpolation)

would make that possible I believe.

Improve 'Stop close on click when on timer'

Pull request #27 was a nice improvement!

I wonder though, could you add a global option to no close the notification on a simple (2nd) click inside the notification? Particularly, when I already have the close icon, I think this is a desirable option. That way, I have the option to:

  • Stop the notification from hiding using a first click in the notification
  • Have the ability to Copy the notification's text (I found this to be handy in case of error popping up)
  • Click the close icon to dismiss the notification

Also, can you make the counter configurable so I can disable it?

Single-click close

Is there a way to have it close on a single click? It would be more intuitive than double-clicking, and I'm concerned about the hitbox of the "X" on touch devices.

I'd be happy to submit a PR if needed.

mouseover/mouseenter halt the close timer

feat

if you mouseover/mouesenter an alert, it should halt the timer, or if not halt the timer, do not hide the message until the mouseout/mouseleave event is fired?

Angular 1.3 ngMessages

Angular 1.3 is release, first of all we should check any compatibility issues with angular 1.3. Also they included a ngMessages directive for form validation, kinda of taking over this plugin for a small part.

Can be interesting to provide support for ngMessages (so we can build on it)

https://docs.angularjs.org/api/ngMessages

any suggestions or comments are welcome!

Display the message after reload/redirect

Hello,
would it be possible to queue one or multuple messages and then release them in another view ?
Take the typical login screen example :
The user enter the credentials.
It fails, direct growl message displayed : "Password doesn't match".
On success, within the current controller, we do something like :

growl.queue.success('Welcome !');
$state.go('home');

wrong index initialization in destroyAllMessages function

In version v0.7.3, the destroyAllMessages function is defined like this :

this.destroyAllMessages = function (referenceId) {
  var messages = this.getAllMessages(referenceId), i = messages.length;
  for (i - 1; i >= 0; i--) {
    messages[i].destroy();
  }
  if (this.directives[referenceId]) {
    this.directives[referenceId].messages = [];
  }
};

On the first loop, notice the i - 1 statement which does nothing. Calling this method on an empty messages array will iterate one time and will raise an exception because messages[0] returns undefined.

I propose the following version :

this.destroyAllMessages = function (referenceId) {
  var messages = this.getAllMessages(referenceId);
  for (var i = messages.length - 1; i >= 0; i--) {
    messages[i].destroy();
  }
  if (this.directives[referenceId]) {
    this.directives[referenceId].messages = [];
  }
};

Error in built files

There are some errors in built files in growlMessages.destroyAllMessages method.

From angular-growl.min.js:

var b = this.getAllMessages(a),
    c = b.length;
for (c - 1; c >= 0; c--) b[c].destroy();

From angular-growl.js:

var messages = this.getAllMessages(referenceId), i = messages.length;
for (i - 1; i >= 0; i--) {
  messages[i].destroy();
}

It does not match to its source:

var messages = this.getAllMessages(referenceId);
for (var i = messages.length - 1; i >= 0; i--) {
  messages[i].destroy();
}

bower install angular-growl-2 installs old/wrong package

from terminal:
└─▪ bower install angular-growl-2 --save
bower angular-growl-2#* cached git://github.com/mattduffield/angular-growl.git#0.3.4
bower angular-growl-2#* validate 0.3.4 against git://github.com/mattduffield/angular-growl.git#*
bower angular-growl-2#~0.3.4 install angular-growl-2#0.3.4

After much confusion I finally realized that angular-growl-2 (the name of your repo) actually installs @mattduffield's angular-growl project.

@mattduffield any chance you can unregister, and allow this project to take that bower name to avoid confusion for most folks since this project has more activity and stars?

Error: undefined is not an object (evaluating 'directive.messages')

Any idea what's going on here? plunkr.

addMessage@https://raw.githubusercontent.com/JanStevens/angular-growl-2/master/build/angular-growl.js:315:31
broadcastMessage@https://raw.githubusercontent.com/JanStevens/angular-growl-2/master/build/angular-growl.js:193:52
sendMessage@https://raw.githubusercontent.com/JanStevens/angular-growl-2/master/build/angular-growl.js:222:32
info@https://raw.githubusercontent.com/JanStevens/angular-growl-2/master/build/angular-growl.js:231:27
http://run.plnkr.co/wEbSdNT3pnBuUoIq/app.js:4:13
invoke@https://code.angularjs.org/1.3.5/angular.js:4138:22

Sometimes single message not shown

Same as

marcorinck#18

function addMessage(message) {
    $scope.messages.push(message);
    if (message.ttl && message.ttl !== -1) {
        $timeout(function () {
            $scope.deleteMessage(message);
        }, message.ttl);
    }
    $scope.$apply();  // this line fix problem
}

Credits & thx to CalmNad

Feature request: Return the configuration object on config methods

Right now I'm setting the global configuration as this:

  growlProvider.globalTimeToLive(5000);
  growlProvider.globalDisableIcons(true);

which reads awfully.

When doing:

  growlProvider
            .globalTimeToLive(5000)
            .globalDisableIcons(true);

It is triggering the following error:

growlProvider.globalTimeToLive(...) is undefined

so it appears it is not retuning the growlProvider instance.

Can this be added so we can chain config setters?

Growl message that can't be closed by the user

I'd like to be able to display a permanent message which can then be closed programmatically depending on some condition. I have a constant web socket connection to the server and would like to remove the message when the warning no longer applies. For now I might be able to remove pointer-events to get it to work.

Feature of the closing options of the growl message

hello,

After issues #53, #51 and #49 we need standardise the way we close a growl notification. A little explanation:

Right now the growl message is shown and the counter shows how long the growl message will be visible. Then a user can click on it to keep the growl notification displayed and click on it again to remove the growl. Clicking on the close button will remove the growl message immediately.

A couple of things happen and I would like to define some flows so everything is standardised and configurable and clear.

Proposal

  • Show count down timer: True/False
  • Configurable pauze option: This would be a string indicating how the user can pauze the growl notification, possibilities are: onhover, onclick, or disabled (suggestions?). Also an onpauze trigger will be called.
  • Configurable close option: This would be a string that defines how we can close the growl notification, possibilities are: onclick, onclosebutton (using this will show the close button else it will be hidden),

Possible issues

  • The disable close button would be dynamically determined instead of configurable.

This of course limits the possibilities, but will allow for easily extending the possible pauze and close handling.

Any thoughts or comments? Input very much needed as I don't know which direction to go.

addServerMessages doesn't use global config

I found out that addServerMessages function (the one used by serverMessagesInterceptor) overrides global config parameters check this lines.

It might be possible to use angular.extend in order to retain the current global setup? Or maybe just take server parameters over default ones.

I prefer extend angular-growl-2 features over making my own logic.

What do you think?

Angular 1.3 compatibility fix #20 breaks 1.2.x

I have got an issue with angular-growl-2 master and my app which fatally breaks all http stuff in Angular 1.2.16 up to .21. Fortunately it also happens with demo/demo.html page. The growl doesn't work and after opening the page the browser console logs the following:

TypeError: object is not a function
at v.splice.response (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js:73:225)
at u (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js:97:280)
at u (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js:97:280)
at https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js:98:417
at h.$eval (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js:108:482)
at h.$digest (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js:106:62)
at h.$apply (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js:109:287)
at https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js:18:23
at Object.d [as invoke] (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js:34:265)
at $b.c (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js:17:439) angular.js:9778
Error: [$compile:tpload] http://errors.angularjs.org/1.2.16/$compile/tpload?p0=templates%2Fgrowl%2Fgrowl.html
at Error (<anonymous>)
at https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js:6:450
at https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js:59:506
at https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js:71:79
at F (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js:97:351)
at https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js:99:51
at h.$eval (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js:108:482)
at h.$digest (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js:106:62)
at h.$apply (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js:109:287)
at https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js:18:23 angular.js:9778

The problem is caused by c5b5a89 introduced by #20 fix. Angular 1.3 API requires objects in interceptor mechanics however 1.2.x still needs a function. The template loading error is caused by malfunctioning interceptor.

improper calculation of message params

growlFactory.js, ~line 163:
enableHtml: _config.enableHtml || _enableHtml

The intention is supposed to be, being able to override the global provider properties per messages - the way above it is not proper (if either is true, the result is true). The proper way is:
enableHtml: _config.enableHtml===undefined ? _enableHtml : _config.enableHtml,

disable automatic translation

Hi !

I'm using your very nice plugin but today I'm facing an issue : I'm using angular-translate and obviously want to display some translated messages in growl notifications but not always !

Lets' take an example :

growl.error( $translate("ERROR") + ' : ' + JSON.stringify(data.message), {referenceId: 'admin-login', ttl: 5000});

this displays me :
[object Object] : "bad credentials" doesn't exist

Because I don't know what will be data.message, I only want to translate ERROR, but growl also tries to translate the whole message.

More problematic, if I set :

growl.error( $translate("ERROR"), {referenceId: 'admin-login', ttl: 5000});

I get an error :
TypeError: undefined is not a function
at Object.B (https://cdn.jsdelivr.net/angular.translate/2.4.2/angular-translate.min.js:6:773)
at Function.N.instant (https://cdn.jsdelivr.net/angular.translate/2.4.2/angular-translate.min.js:6:9275)
at c (https://cdn.jsdelivr.net/angular.translate/2.4.2/angular-translate.min.js:6:12965)
at u (http://mysite.com/js/angular/angular-growl-2/build/angular-growl.min.js:6:3470)
at v (http://mysite.com/js/angular/angular-growl-2/build/angular-growl.min.js:6:4168)
at Object.x as error
at http://mysite.com/js/app/Admin/AdminController.js:73:27
at https://ajax.googleapis.com/ajax/libs/angularjs/1.3.3/angular.min.js:80:169
at https://ajax.googleapis.com/ajax/libs/angularjs/1.3.3/angular.min.js:110:505
at k.$eval (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.3/angular.min.js:124:325)

But if I only set :

growl.error( "ERROR", {referenceId: 'admin-login', ttl: 5000});

everything is displaying perfectly !

It would be very nice if we could set an option to manually handle transaltion behavior like :

growl.error(MY_MESSAGE, {translate: no});

Please let me know what you think about it ! Thanks

Hugo

setting the position via property

It seems that in the factory there is a property of position on the message which takes the global position || position as set in the instance.

However doing this
growl.success("", {title: 'Thanks', position: 'top-left'});

doesn't seem to override the globalPosition, am i configuring it wrong?

thanks

Greg

Example code uses deprecated API

Heading: Handeling Server Sent Notifications
Section: The default message, text, severity an...

It is written there

app.config(["growlProvider", "$httpProvider", function(growlProvider, $httpProvider) {
    growlProvider.messagesKey("my-messages");
    growlProvider.messageTextKey("message-text");
    growlProvider.messageTitleKey("message-title");
    growlProvider.messageSeverityKey("severity-level");
    $httpProvider.responseInterceptors.push(growlProvider.serverMessagesInterceptor);
}]);

But $httpProvider.responseInterceptors is deprecated. $httpProvider.interceptorsshould be used instead.

Allow pausing timer with hover

It would be nice to have an option to allow mouseenter and mouseleave to pause and restart the timer, instead of just click. This would work more like Growl does, where hovering allows you to pause the message from disappearing.

Please update bower.json to include css in main

Please update bower.json to include the non-minified CSS file[angular-growl.css ] in main so that Grunt/Gulp's wiredep package can automatically add this CSS to index.html and project specific build steps [uglify, minify, csso etc.,] can take care of minification.

Even better include angular-growl.scss for those who are using SCSS :)

  "main": [
      "build/angular-growl.js",
      "build/angular-growl.css"
    ],

Impossible to send notifications to another AngularUI Router state

Hello. I use the AngularUI Router in my application. I've found that it is almost impossible to send notifications to growl directives in other views. Here is a use case:

There is an application with 2 pages/routes/states.
The first page has the growl directive in a view: <div growl inline="true" reference="page1"></div>

  1. A user of the application goes to the first page.
  2. The user goes to the second page.
  3. A controller of the second page calls growl.success('Message', { referenceId: 'page1' });
  4. The user navigates to the first page.
  5. The user sees nothing.

As I understand, the problem is in this line of code:
https://github.com/JanStevens/angular-growl-2/blob/master/src/growlDirective.js#L18

When the user navigates to the first page again, the directive tries to initialize itself once more time and clears all its messages here:
https://github.com/JanStevens/angular-growl-2/blob/master/src/growlMessageService.js#L39

I have not dug deeply into the code and don't know why directives and preloadDirectives are separated. But this problem probably could be solved at least by preventing the directive from reinitialization (https://github.com/JanStevens/angular-growl-2/blob/master/src/growlDirective.js#L18):

if (!growlMessages.directives[$scope.referenceId]) {
  growlMessages.initDirective($scope.referenceId, $scope.limitMessages);
}

or by enhancing initialization logic (https://github.com/JanStevens/angular-growl-2/blob/master/src/growlMessageService.js#L32-L45):

this.initDirective = function (referenceId, limitMessages) {
    if (preloadDirectives[referenceId]) {
        this.directives[referenceId] = preloadDirectives[referenceId];
        this.directives[referenceId].limitMessages = limitMessages;
    } else if (!this.directives[referenceId]) {
        this.directives[referenceId] = {
            messages: [],
            limitMessages: limitMessages
        };
    }
    return this.directives[referenceId];
};

translate with parameters

Hey,
With angular-translate we can use parameters in our messages like $translate('i18n.key', {parameter: value}), however this is not yet possible with growl.

Is this feature in any backlog ? I can make a PR...

Thx

growl not working in angular.module.run

Hello everyone,

I don't know whether this is a bug or not, but currently the growl's functions do not work when they are invoked within angular.module.run.

Example:

angular
    .module('justAModule', [
        'angular-growl'
    ])
    .run(function(growl) {
        growl.info('Just an info');
    });

In particular the functions seem to fail silently.
Any thoughts?

weird template expression in growlDirective.js

~line 11: ng-show="!message.enableTitle"

  • attribute "enableTitle" is never set/used/documented so that is undefined - the expression is of course will always be evaluated to be true
  • the expression is semantically bad, correct way would be: ng-show="message.enableTitle"

New npm build?

I'd love to get the new globalPosition() feature, but it isn't included in the current build available from NPM.

I actually tried to use the source directly from here, but in that case the "unique message" options seems to be buggy, which is pretty important for my usecase. Do you have an estimate for the next fix and NPM push? :)

Question about setting message.close on TTL -1 growls

Why are we not setting the message.close if we create a growl that has a TTL of -1?

If we close a growl with that setting, then message.close gets set to true.
Creating a growl with a TTL of -1 has no message.close set.
Creating a growl normally gets message.close set to false.

Responsive interceptor error used to work in angular-growl - did this get removed?

All my services return a response object which has a view model and a message list called Messages

In angular-growl I could set it up using this code....

app.config(["growlProvider", "$httpProvider", function(growlProvider, $httpProvider) {
growlProvider.globalTimeToLive(3000);
growlProvider.messagesKey("Messages");
growlProvider.messageTextKey("MessageText");
growlProvider.messageSeverityKey("SeverityLevel");
growlProvider.onlyUniqueMessages(true);
$httpProvider.responseInterceptors.push(growlProvider.serverMessagesInterceptor);
}]);

now I get this error

TypeError: object is not a function
at $get.reversedInterceptors.splice.response (http://localhost:61561/Scripts/angular.js:7546:18)
at deferred.promise.then.wrappedCallback (http://localhost:61561/Scripts/angular.js:11561:81)
at deferred.promise.then.wrappedCallback (http://localhost:61561/Scripts/angular.js:11561:81)
at http://localhost:61561/Scripts/angular.js:11647:26
at Scope.$get.Scope.$eval (http://localhost:61561/Scripts/angular.js:12673:28)
at Scope.$get.Scope.$digest (http://localhost:61561/Scripts/angular.js:12485:31)
at Scope.$get.Scope.$apply (http://localhost:61561/Scripts/angular.js:12777:24)
at http://localhost:61561/Scripts/angular.js:1447:15
at Object.invoke (http://localhost:61561/Scripts/angular.js:3966:17)
at doBootstrap (http://localhost:61561/Scripts/angular.js:1445:14)

I have tried with angular 1.2 and 1.3 and both give the same error

Is there a new way to set up this functionality?

Milestone 0.6.0

After some thoughts, here are the new proposed features:

  1. HTML5 Notification (only for Chrome ATM)
  2. Optional setting a title attribute along with the message
  3. Allow for template editing (non-bootstrap)
  4. Define some other templates (non-bootstrap)

First one is more of a proof of concept, I have the basics down and should be fun to use it. Planning on adding a native fall back method if the user does not grant access for the notifications or they are not supported.

Second feature allows for an optional title attribute along with the message. You could do the same using <h4></h4> tags but this requires enabling HTML. Another point is that native notifications also have a title field (they even have an icon field).

Third feature, I think there are many cases where people would like to change the template of the notification (adding own classes or adding extra stuff), editing the template right now requires overwriting the source code.

Final feature, don't know if it is possible but different templates could be used as an example. Depends if I'm in the mood for CSS'ing

Any other requests are also welcome!

onopen and onclose

I'm using onopen and onclose hooks, but after looking at the code I realise that hte version 0.7.0 downloaded using bower is not the last version. Those hooks are missing.

Could you tag a new version with the current code to download using bower?

Thanks,

Boostrap's dependency

Just a suggestion - it would be nice to have a boostrap-independent version of growl2.

Support for HTML and directives

Hi, right now I need to use directives inside a notification and it doesn't work because $sce.trustAsHtml is not supposed to work with directives (see here).

Current code:

growl.error('<h4>WebSocket</h4>' + gettext('Reconnecting...') + '<refresh-button></refresh-button>', {ttl: 10000})

Where <refresh-button> is a custom directive.

One of the ways I can see solving this is by adding a declarative API like this one,
any other way?

onClose event?

Greetings,

It would be nice if there would be a way to get a notification when someone explicitly removes an event (click the 'x' mark). If anyone is interested, all I would need is a quick primer on how to add code and build it :)

Set globalTimeToLive by severity

It would be nice to set globalTimeToLive by severity.

Something like
growlProvider.globalTimeToLive(2000, 'success');
growlProvider.globalTimeToLive(0, 'error'); // 0 meaning the need to close using close button

Icon disable graphic bug

When I disable icons using growlProvider.globalDisableIcons(true); I get a growl looking like this:
screen shot 2014-08-08 at 2 42 58 pm

Centered growl not positioned correctly (incl. fix)

Because max-width=400px, margin-left should probably be -200px for centered positionings instead of -150px.

Greetings

.growl-container.growl-fixed.top-center {
top: 10px;
left: 50%;
margin-left: -200px;
}
.growl-container.growl-fixed.bottom-center {
bottom: 10px;
left: 50%;
margin-left: -200px;
}

Replace base64 icons with font icons (font-awesome)

Hello,
as I know it's totally possible to do it, how would you replace the default base64 icons with font-awesome ones ? Could you provide a working example of how to do it properly ?
Thanks for the hard work ! :)

onlyUniqueMessages gets tripped up by rapidly triggered notifications

Since the check for unique messages is in the main event loop, but the actual addition of the message is in a $timeout(...), sometimes I have as many as three of the same message get added to the list, since the first two $timeouts(...) did not trigger in time.

I'm not sure why there is a $timeout(...) in addMessage to begin with, but if there's a reason for it, then should the check for uniqueMessages be moved to within addMessage itself?

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.