Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow use angular directives inside message #100

Open
loverajoel opened this issue Jul 27, 2015 · 3 comments
Open

Allow use angular directives inside message #100

loverajoel opened this issue Jul 27, 2015 · 3 comments

Comments

@loverajoel
Copy link

growl.addWarnMessage('<a href ng-click='buttonClick()'>Call function</a>', {enableDirectives: true});

@mtlehtin
Copy link

This would be handy in some cases.

For example I have a list of messages and growl-message is popped up when the list has some changes. Then the user is asked to refresh the list by clicking a refresh-link inside the growl-message. However this is not possible at this moment. Instead I'm using the onclose-callback which is quite handy. But I would like to prefer the clickable link in this case.

So +1 for this feature.

@faisalferoz
Copy link

+1

@hugsbrugs
Copy link

As simple as (in your run block) :

$templateCache.put('templates/growl/growl.html', '<div class="growl-container" ng-class="wrapperClasses()">' + '<div class="growl-item alert" ng-repeat="message in growlMessages.directives[referenceId].messages" ng-class="alertClasses(message)" ng-click="stopTimeoutClose(message)">' + '<button type="button" class="close" data-dismiss="alert" aria-hidden="true" ng-click="growlMessages.deleteMessage(message)" ng-show="!message.disableCloseButton">&times;</button>' + '<button type="button" class="close" aria-hidden="true" ng-show="showCountDown(message)">{{message.countdown}}</button>' + '<h4 class="growl-title" ng-show="message.title" ng-bind="message.title"></h4>' + '<div class="growl-message" translate="{{message.text}}" translate-compile></div>' + '</div>' + '</div>');

I have replaced

ng-bind-html="message.text"

by

translate="{{message.text}}" translate-compile

I invite you to add in your config block :

growlProvider.globalTranslateMessages(false);

to avoid multiple translations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants