-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_component.txt
More file actions
37 lines (29 loc) · 894 Bytes
/
Copy pathtest_component.txt
File metadata and controls
37 lines (29 loc) · 894 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { Component, OnInit, ViewContainerRef } from '@angular/core';
import { ToastsManager } from "ng2-toastr";
@Component({
selector: 'app-test',
templateUrl: './test.component.html',
styleUrls: ['./test.component.css']
})
export class TestComponent implements OnInit {
constructor(public toastr: ToastsManager, vcr: ViewContainerRef) {
this.toastr.setRootViewContainerRef(vcr);
}
ngOnInit() {
}
showSuccess(){
this.toastr.success('You are awesome!', 'Success');
}
showError(){
this.toastr.error('This is not good!', 'Oops');
}
showWarning() {
this.toastr.warning('You are being warned.', 'Alert!');
}
showInfo() {
this.toastr.info('Just some information for you.');
}
showCustom() {
this.toastr.custom('<span style="color: red">Message in red.</span>', null, { enableHTML: true });
}
}