Can you guide me on how to include toastr in an angular app?
Currently, I am enrolled in the Angular Fundamentals course and trying to use toastr.success within my export class
:
handleThumbnailClick(eventName){
toastr.success(eventName)
}
But, I keep encountering this error:
https://i.sstatic.net/VPOGb.png
Here's the content of my ts
file:
import { Component, OnInit } from '@angular/core'
import { EventService } from './shared/event.service'
declare let toastr
@Component({
selector: 'events-list',
template: `<div>
<h1>upcoming angular components</h1>
<hr>
<div class="row">
<div class="col-md-5" *ngFor="let event of events">
<event-thumbnail (click)="handleThumbnailClick(event.name)" [event]="event"></event-thumbnail>
</div>
</div>
</div>`})
export class EventsListComponent implements OnInit {
events:any[]
constructor(private eventService: EventService) {
}
ngOnInit() {
this.events = this.eventService.getEvents()
}
handleThumbnailClick(eventName){
toastr.success(eventName)
}
}
I have used npm install toastr --save
to install toastr and made the necessary modifications in the angular.json
file:
https://i.sstatic.net/EO2NO.png
Any insights on why toastr is not displaying correctly?