Angular Toastr Npm Code Example


Example 1: angular toastr

npm install ngx-toastr --save npm install @angular/animations --save  // angular.json "styles": [   "styles.scss",   "node_modules/ngx-toastr/toastr.css" // try adding '../' if you're    										// using angular cli before 6 ]  // app.module import { CommonModule } from '@angular/common'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { ToastrModule } from 'ngx-toastr';  imports: [     CommonModule,     BrowserAnimationsModule, // required animations module     ToastrModule.forRoot(), // ToastrModule added   ],    // component import { ToastrService } from 'ngx-toastr';  constructor(private toastr: ToastrService) {}  showSuccess() {   this.toastr.success('Hello world!', 'Toastr fun!'); }

Example 2: how to add toaster in angular 9

npm install ngx-toastr --save

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable