Adding Toastr Notifications in Angular 9 Tutorial

Today, We want to share with you Adding Toastr Notifications in Angular 9 Tutorial.In this post we will show you Angular 9 Toastr Notifications Example, hear for angular 6 toast notification we will give you demo and example for implement.In this post, we will learn about Implement Toastr Notification In Angular 7|8|9 with an example.

Adding Toastr Notifications in Angular 9 Tutorial

There are the Following The simple About How to Create Angular Toastr Notifications Full Information With Example and source code.

As I will cover this Post with live Working example to develop ngx-toastr angular 8, so the ngx-toastr angular 7 is used for this example is following below.

Phase 1: Make New App

angular 9 app using bellow command:

ng new my-new-shop

Phase 2: Install Toastr

install ngx-toastr and @angular/animations npm packages

npm install ngx-toastr --save
npm install @angular/animations --save


    "styles": [

Phase 3: Import Module


import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ToastrModule } from 'ngx-toastr';
  declarations: [
  imports: [
  providers: [],
  bootstrap: [AppComponent]
export class AppModule { }

Phase 4: Make Service for Notification

run bellow command:

ng generate service notification


import { Injectable } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
  providedIn: 'root'
export class NotificationService {
  constructor(private toastr: ToastrService) { }
  displaySuccess(message, title){
      this.toastr.success(message, title)
  displayError(message, title){
      this.toastr.error(message, title)
  displayInfo(message, title){, title)
  displayWarning(message, title){
      this.toastr.warning(message, title)

Phase 5: Updated View File


<h1>Angular 9 Toastr Notifications Example -</h1>
<button (click)="displayToasterSuccess()">
    Success Toaster
<button (click)="displayToasterError()">
    Error Toaster
<button (click)="displayToasterInfo()">
    Info Toaster
<button (click)="displayToasterWarning()">
    Warning Toaster

Phase 6: Use Component ts File


import { Component } from '@angular/core';
import { NotificationService } from './notification.service'
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
export class AppComponent {
  title = 'toaster-not';
  constructor(private notifyService : NotificationService) { }
      this.notifyService.displaySuccess("Data displayn successfully !!", "")
      this.notifyService.displayError("Your Data is wrong", "")
      this.notifyService.displayInfo("Your Data is info", "")
      this.notifyService.displayWarning("Your Data is warning", "")

Free Live Chat for Any Issue
Web Programming Tutorials Example with Demo

Read :

Read Also:  Angular 6 Toast Message Notifications From Scratch


You can also read about AngularJS, ASP.NET, VueJs, PHP.


I hope you get an idea about How to Create Angular Toastr Notifications?.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.