JanStevens/angular-growl-2

Don't want to close message on double-click.

Opened this issue · 2 comments

I have hidden the default close button in growl message but still when I double click on message it closes/hide. I want the message to display permanently not fade out/hide/close on double click.
My growl message contains some links inside it, so I can't do "pointer-events:none" on open event .

Please suggest. How to do it?

Hi there,

We had need of this functionality as well, so I looked into it a bit. Take a look here:

if (!message.clickToClose) {

It seems that there is a check here introduced with a910139 that checks to see if there is a flag that disables click to close. However, this is the only instance of this property that I can see. It is not set anywhere that I can see.

I was able to get around this by tweaking a few things. I don't have a diff available to me right now (and I may make a pull request for this later), but I changed that line to look like:

if (!message.disableClickToClose) {

Then I added a default value to this line:

}, _messagesKey = 'messages', _messageTextKey = 'text', _messageTitleKey = 'title', _messageSeverityKey = 'severity', _onlyUniqueMessages = true, _messageVariableKey = 'variables', _referenceId = 0, _inline = false, _position = 'top-right', _disableCloseButton = false, _disableIcons = false, _reverseOrder = false, _disableCountDown = false;

..., _disableCloseButton = false, ...

Finally I added the following to the message object on

disableClickToClose: _config.disableClickToClose === undefined ? _disableClickToClose : _config.disableClickToClose,

I was then able to call a growl with the following:

growl.error('This is an error.', { ttl: -1, disableCloseButton: true, disableClickToClose: true })

Again, I might make a pull request that introduces something like this. I'm thinking changing it to a permanent flag, which would disable TTL, the close button, and click to close.

I've added a pull request to address this issue. :)