Foxandxss/angular-toastr

Customization config with ES6

Opened this issue · 2 comments

Hi!

I'm trying to override the default configurations because always show an error about toast.html but is not working and of course, maybe I'm doing something wrong.

`'use strict';

export default class ToastrConfig {
    /* @ngInject */

    static options(toastrConfig) {

        toastrConfig = {
            autoDismiss: false,
            containerId: 'toast-container',
            maxOpened: 0,
            newestOnTop: true,
            positionClass: 'toast-top-right',
            preventDuplicates: false,
            preventOpenDuplicates: false,
            target: 'body'
        };
    }
}`

Do you have any idea about how to fix this issue?

Are you using the .tpls version?

try with angular.extend...

'use strict';

import angular from 'angular';

export default class ToastrConfig {
    /* @ngInject */
    static options(toastrConfig) {

       angular.extend(toastrConfig, {
            autoDismiss: false,
            containerId: 'toast-container',
            maxOpened: 0,
            newestOnTop: true,
            positionClass: 'toast-top-right',
            preventDuplicates: false,
            preventOpenDuplicates: false,
            target: 'body'
        });
    }
}