alexcrack / angular-ui-notification

Angular.js service providing simple notifications using Bootstrap 3 styles with css transitions for animating
MIT License
536 stars 169 forks source link

Check notification type in custom template #66

Closed gugahoi closed 8 years ago

gugahoi commented 8 years ago

Just wanted to know if there is a way to do this.

I would like the icons within my custom notifications to be different for error, warning and success types however I see no way of doing that other that passing in the icon html with the message or creating a new scope to pass in.

Is there a way to check the notification "type" inside a custom template?

alexcrack commented 8 years ago

Try to use scoped variable 't' This variable set to the first letter of the message class name For example "error" -> t = "e"

gugahoi commented 8 years ago

That's perfect! Below is a sample of what I was wanting to do:

<div class="ui-notification">
    <h3 ng-show="title">
        {{title}}
        <i class="fa fa-check-circle pull-right" ng-show="t === 's'"></i>
        <i class="fa fa-exclamation-circle pull-right" ng-show="t === 'w'"></i>
        <i class="fa fa-times-circle-o pull-right" ng-show="t === 'e'"></i>
    </h3>
    <div class="message" ng-bind-html="message"></div>
</div>

Or use it with ngClass as needed!