Toast message angular
import { ToastrService } from 'ngx-toastr';
Toast message angular
import { ToastrService } from 'ngx-toastr';
Toast message angular
npm install ngx-toastr --save
npm install @angular/animations --save
install toastr in angular
npm install ngx-toastr --save
Toast message angular
"styles": [
"src/styles.css",
"node_modules/ngx-toastr/toastr.css"
]
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.")
}
}
Toast message angular
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ToastrModule } from 'ngx-toastr';
import { RootComponent } from './root/root.component';
@NgModule({
declarations: [
RootComponent
],
imports: [
BrowserModule,
BrowserAnimationsModule,
ToastrModule.forRoot()
],
providers: [],
bootstrap: [RootComponent]
})
export class AppModule { }
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us