cadulis / ngx-toasty

MIT License
4 stars 5 forks source link

styles not loading going from ng2-toasty to ngx-toasty #1

Open phil123456 opened 6 years ago

phil123456 commented 6 years ago

bug

styles are not loading

had a project using ng2-toasty, upgraded to ngx-toasty, apparentlyt no change need to be made but styles do not load

load styles

  "@angular/animations": "^5.2.0",
    "@angular/common": "^5.2.0",
    "@angular/compiler": "^5.2.0",
    "@angular/core": "^5.2.0",
    "@angular/forms": "^5.2.0",
    "@angular/http": "^5.2.0",
    "@angular/platform-browser": "^5.2.0",
    "@angular/platform-browser-dynamic": "^5.2.0",
    "@angular/router": "^5.2.0",
    "@ngui/tab": "^0.5.0",
    "angular-progress-http": "^1.0.0",
    "angular2-cookie": "^1.2.6",
    "angular2-prettyjson": "^3.0.1",
    "core-js": "^2.4.1",
    "mydaterangepicker": "^4.2.1",
    "ng2-charts": "^1.6.0",
    "ng2-validation": "^4.2.0",
    "ngx-accordion": "0.0.17",
    "ngx-toasty": "^1.0.0",
    "rxjs": "^5.5.6",
    "tinymce": "^4.7.11",
    "zone.js": "^0.8.19"

in app.component.ts :

import 'ngx-toasty/style-default.css';

code that used to work:

 notification(message:string,type:number)
    {
        //this.toastyService.default(message);
        // Or create the instance of ToastOptions
        var toastOptions:ToastOptions = {
            title: "???",
            msg: message,
            showClose: true,
            timeout: 5000,
            theme: 'default',
            onAdd: (toast:ToastData) => {
                console.log('Toast ' + toast.id + ' has been added!');
            },
            onRemove: function(toast:ToastData) {
                console.log('Toast ' + toast.id + ' has been removed!');
            }
        };
        // Add see all possible types in one shot
        switch(type)
        {
            case Atom.INFO:        toastOptions.title=this.getTrad("Info"); this.toastyService.info(toastOptions);break;
            case Atom.WARNING:     toastOptions.title=this.getTrad("Warning"); this.toastyService.warning(toastOptions);break;
            case Atom.ERROR:       toastOptions.title=this.getTrad("Error"); this.toastyService.error(toastOptions);break;
            case Atom.SUCCESS:     toastOptions.title=this.getTrad("Success"); this.toastyService.success(toastOptions);break;
            case Atom.WAIT:        toastOptions.title=this.getTrad("Wait"); this.toastyService.wait(toastOptions);break;
        }
    }
phil123456 commented 6 years ago

apparently encapsulation needs to be set to none