1.0.5 • Published 6 years ago
toast-dev007 v1.0.5
Project Title
toast-dev007
Getting Started
install the package with this command: npm i toast-dev007
Add this line in the your App module
import { ToastModule } from 'super-toasty'; <-- Add this
@NgModule({
declarations: [
AppComponent
],
imports: [
. . . . ,
ToastModule.forRoot({ brand: 'XYZ' }) <-- Add this
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Add this line in the your App component
import { ToastService } from 'super-toasty'; <-- Add this
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
title = 'newApp';
constructor(
private toastServ: ToastService <-- Add this
) {}
ngOnInit() {
}
MakeToast() {
this.toastServ.showToast('error', 'My Title', 'Body of the toast'); <-- use this to show toast
}
closeToast() {
this.toastServ.clearToast(); <-- use this to remove toast
}
}
There is only two themes available for this toast
send 'success' or 'error' as first parameter and then send the Title, the Body, and time (optional) as the parameter to the showToast method
this.toastServ.showToast('error', 'Title', 'Body', 5000);
Deployment
Add additional notes about how to deploy this on a live system
Built With
- Angular - The web framework used
Authors
- Debansu Karmakar - Initial work - https://github.com/debansu1996