naveen naveen - 7 months ago 44
AngularJS Question

Why is angular-toastr not accepting the overriden postionClass.?

Plugin used:

My intention is to create a toastr that spans the full with of the page on top and according to the documentation,

positionClass: 'toast-top-full-width'
will do the trick.

toastr.success('Hello world!', 'Toastr fun!', {
positionClass: 'toast-top-full-width'

A peek into the plugins css also validate the claim.

.toast-top-full-width {
top: 0;
right: 0;
width: 100%;

But somehow, the code doesn't work. Whats wrong with my code?



You need to configure the toast in the angular config.

var app = angular.module('app', ['ngAnimate', 'toastr']);

 app.config(function(toastrConfig) {
   angular.extend(toastrConfig, {
    positionClass: 'toast-top-full-width'

 app.controller('toastr-demo', function($scope, toastr) {
    toastr.success('Hello world!', 'Toastr fun!');