Hi,
Currently, I'm using an Angular based template but I noticed that Toastr is not part of the demo. Searching on the documentation, I noticed that it is implemented as part of HTML.
https://preview.keenthemes.com/html/metronic/docs/general/toastr
Do you have a workaround to use Metronic Toastr for Angular applications?
PD: This is critical for my notifications system and I would like to continue using the Metronic look and feel and avoid installing external libraries that add more weight to the application.
Thanks in advance.
Hi Carlos,
You can use the Metronic Toastr for Angular applications by installing the ngx-toastr package. Here are the steps:
1. Install the ngx-toastr package using npm:
npm install ngx-toastr
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { ToastrModule } from "ngx-toastr";
@NgModule({
imports: [
BrowserAnimationsModule,
ToastrModule.forRoot()
]
})
import { ToastrService } from "ngx-toastr";
@Component({
...
})
export class MyComponent {
constructor(private toastr: ToastrService) {}
showMessage() {
this.toastr.success("Message sent successfully!");
}
}
_toastr.scss
file, which can be found in the demo1/src/assets/sass/core/vendors/plugins/
directory. You can also confirm that it is imported in the _plugins.scss
file located in the same directory.