toast notification in angular code example

Example 1: Toast message angular

import { ToastrService } from 'ngx-toastr';

Example 2: Toast message angular

import { Component, OnInit } from '@angular/core';
import { ToastrService } from 'ngx-toastr';

@Component({
  selector: 'app-root',
  templateUrl: './root.component.html',
  styleUrls: ['./root.component.css']
})
export class RootComponent implements OnInit {

  constructor(private toastr: ToastrService) { }

  ngOnInit() {
      
  }
 
  showToaster(){
      this.toastr.success("Hello, I'm the toastr message.")
  }

}

Tags:

Misc Example