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

How to set custom template URL #33

Closed lukeclifton closed 9 years ago

lukeclifton commented 9 years ago

Hey there,

By default the service looks for the notification template at '/angular-ui-notification.html'.

How do we go about setting this value in our app with a custom template URL?

Thanks,

Luke

alexcrack commented 9 years ago

You can pass custom template for example

<script type="text/ng-template" id="custom_template.html">
    <div class="ui-notification custom-template">
        <div class="message" ng-bind-html="message"></div>
    </div>
</script>

and use it

Notification.primary({message: "Just message", template: "custom_template.html"});

Also you can pass any template url to template option

lukeclifton commented 9 years ago

Ok thanks.

It would be awesome to be able to pass a 'templateUrl' param to the config options. That means you don't have to repeat yourself by adding in the 'template' value every time you write a Notification when using a custom template location.

I've copied the script for now and manually changed the 'uiNotificationTemplates' value but this stops me using the module from bower directly which is a shame.

What do you think?

alexcrack commented 9 years ago

I agree. It would be useful. I will implement it.

lukeclifton commented 9 years ago

Awesome! :)

dgurkaynak commented 9 years ago

+1 for this request.

anonrig commented 9 years ago

+1

damjtoh commented 9 years ago

Maybe you want to try this: cb859bfff7bd730463980073afc17318055b971d

alexcrack commented 9 years ago

Added option 'templateUrl' in v0.0.12 (f843c43). Option can be passed to the configuration provider and also to Notification's methods. See examples in ./demo directory.

Attention Value-service "uiNotificationTemplates" has been deleted!