Get 2024 Templates Mega Bundle!$1000 worth of 19 Bootstrap HTML, Vue & React Templates + 3 Vector Sets for just $99
Get for 99$

Toastr notification for Angular templates


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.


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (1)

Deleted comment

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


2. Import the BrowserAnimationsModule and ToastrModule in your app.module.ts file:


import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { ToastrModule } from "ngx-toastr";

@NgModule({
imports: [
BrowserAnimationsModule,
ToastrModule.forRoot()
]
})


3. In your component where you want to use Toastr, import the ToastrService and use it in your code:


import { ToastrService } from "ngx-toastr";

@Component({
...
})
export class MyComponent {
constructor(private toastr: ToastrService) {}

showMessage() {
this.toastr.success("Message sent successfully!");
}
}


With this setup, you can use the Toastr service in your Angular application. By right, it will keep the Metronic look and feel for your notifications system.

Moreover, the Metronic custom Toastr style is already included in the _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.

Thanks


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(