43
loading...
This website collects cookies to deliver better user experience
npm install ngx-toastr --save
npm install @angular/animations --save
"styles": [
"src/styles.scss",
"node_modules/ngx-toastr/toastr.css"
],
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ToastrModule } from 'ngx-toastr';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
BrowserAnimationsModule,
ToastrModule.forRoot()
],
providers: [],
bootstrap: [AppComponent]
})
import { ToastrService } from 'ngx-toastr';
export class LandingComponent implements OnInit {
constructor(private toastr:ToastrService) { }
ngOnInit(): void {
}
showToastr(){
this.toastr.success('This is the success toastr')
}
}
showToastr(){
this.toastr.success('This is the success toastr',"Success")
}
ToastrModule.forRoot({
positionClass: 'toast-top-center'
})
ToastrModule.forRoot({
preventDuplicates: true
})
ToastrModule.forRoot({
closeButton:true
})
ToastrModule.forRoot({
timeOut:2000
})
ToastrModule.forRoot({
maxOpened:2
})
showToastr(){
this.toastr.success('This is the success toastr',"Success")
this.toastr.error('This is the error toastr',"Error",{
timeOut:10000,
closeButton:true
})
}