Angular 2 Toastr
Angular 2 Toastr component is compatible with latest release of Angular 2.X.X for showing alerts and messages for your application.
Usage
Follow these steps:
systemjs.config.js
file.
1. Update your -Add following line in map:
map: //... 'angular2-toastr': 'npm:angular2-toastr'
-and in packages:
packages: //... 'angular2-toastr': main: './index.js' defaultExtension: 'js'
2. Update the index.html
-
Import style into your index.html. Choose one of the following files:
style-default.css
- Contains DEFAULT themestyle-bootstrap.css
- Contains Bootstrap 3 themestyle-material.css
- Contains Material Design theme
OR
-
Copy and Paste :
- Copy and paste these files in your application.
- Link them in your index.html
2. Your Component:
- Add following tag in template of your component where you intend to use .
ng2-toaster =position =theme /ng2-toaster
-
Select the Theme [
default
,bootstrap
,material
]. -
Select the Position [
top-left
,top-right
,top-center
,bottom-left
,bottom-right
,bottom-center
] -
Assign them as shown below:
ng2-toaster ="'top-right'" ="'bootstrap'" /ng2-toaster
Components
3. Import the Import Components in the NgModule of your application as shown below:
;;;
ToasterService
for your application
4. Use the - Import
ToasterService
fromangular2-toaster
in your application code:
;;
OR
- Add Service Globally in NgModule :
;;;
Credits
Inspired by angular-toasty