File tree 5 files changed +8010
-4
lines changed
src/app/routes/notifications/toastr
5 files changed +8010
-4
lines changed Original file line number Diff line number Diff line change 8
8
其功能与core ui基本一致,存在部分改动:
9
9
1 . 改造项目结构,使用angular官方推荐的项目结构
10
10
2 . 添加toastr组件(该相似组件仅在Core UI收费版提供,免费版不提供)
11
+ 3 . 添加首屏渲染
11
12
12
13
# 下一步计划
13
- 1 . toaster组件添加使用angular2-toaster
14
+ 1 . toaster组件添加使用angular2-toaster(已经完成)
14
15
2 . 修复dashboard组件中的bug
15
16
```
16
17
ERROR Error: No value accessor for form control with unspecified
Original file line number Diff line number Diff line change 28
28
</ div >
29
29
</ div >
30
30
<!--/.col-->
31
+ < div class ="col-lg-12 ">
32
+ < toaster-container [toasterconfig] ="config "> </ toaster-container >
33
+ < div class ="card ">
34
+ < div class ="card-header ">
35
+ < i class ="fa fa-align-justify "> </ i > Angular2-Toaster
36
+ < div class ="card-header-actions ">
37
+ < a href ="https://github.com/stabzs/Angular2-Toaster " class ="card-header-action " target ="_blank "> doc</ a >
38
+ </ div >
39
+ </ div >
40
+ < div class ="card-body ">
41
+ <!-- <button type="button" class="btn btn-primary mr-1" (click)="showPrimary2()">
42
+ Try primary
43
+ </button> -->
44
+ < button type ="button " class ="btn btn-success mr-1 " (click) ="showSuccess2() ">
45
+ Try success
46
+ </ button >
47
+ < button type ="button " class ="btn btn-warning mr-1 " (click) ="showWarn2() ">
48
+ Try warning
49
+ </ button >
50
+ < button type ="button " class ="btn btn-danger mr-1 " (click) ="showDanger2() ">
51
+ Try danger
52
+ </ button >
53
+ < button type ="button " class ="btn btn-info mr-1 " (click) ="showInfo2() ">
54
+ Try info
55
+ </ button >
56
+ </ div >
57
+ </ div >
58
+ </ div >
31
59
</ div >
32
60
<!--/.row-->
33
61
</ div >
Original file line number Diff line number Diff line change 1
1
import { Component , OnInit } from '@angular/core' ;
2
2
import { ToastrService } from 'ngx-toastr' ;
3
- import { ToasterService } from 'angular2-toaster' ;
3
+ import { ToasterService , ToasterConfig } from 'angular2-toaster' ;
4
4
5
5
@Component ( {
6
6
selector : 'app-toastr' ,
@@ -9,6 +9,13 @@ import { ToasterService } from 'angular2-toaster';
9
9
} )
10
10
export class ToastrComponent implements OnInit {
11
11
12
+ config : ToasterConfig =
13
+ new ToasterConfig ( {
14
+ showCloseButton : true ,
15
+ tapToDismiss : false ,
16
+ timeout : 0
17
+ } ) ;
18
+
12
19
constructor (
13
20
private toastr : ToastrService ,
14
21
private toasterService : ToasterService
@@ -38,6 +45,52 @@ export class ToastrComponent implements OnInit {
38
45
this . toastr . info ( 'Hello world!' , 'Toastr fun!' ) ;
39
46
}
40
47
48
+ showPrimary2 ( ) {
49
+ // this.toasterService.pop('primary', 'Hello world!', 'Toastr fun!');
50
+ this . toasterService . pop ( {
51
+ type : 'primary' ,
52
+ title : 'Hello world!' ,
53
+ body : 'Toastr fun!' ,
54
+ timeout : 10000
55
+ } ) ;
56
+ }
57
+
58
+ showSuccess2 ( ) {
59
+ this . toasterService . pop ( {
60
+ type : 'success' ,
61
+ title : 'Hello world!' ,
62
+ body : 'Toastr fun!' ,
63
+ timeout : 10000
64
+ } ) ;
65
+ }
66
+
67
+ showWarn2 ( ) {
68
+ this . toasterService . pop ( {
69
+ type : 'warning' ,
70
+ title : 'Hello world!' ,
71
+ body : 'Toastr fun!' ,
72
+ timeout : 10000
73
+ } ) ;
74
+ }
75
+
76
+ showDanger2 ( ) {
77
+ this . toasterService . pop ( {
78
+ type : 'error' ,
79
+ title : 'Hello world!' ,
80
+ body : 'Toastr fun!' ,
81
+ timeout : 10000
82
+ } ) ;
83
+ }
84
+
85
+ showInfo2 ( ) {
86
+ this . toasterService . pop ( {
87
+ type : 'info' ,
88
+ title : 'Hello world!' ,
89
+ body : 'Toastr fun!' ,
90
+ timeout : 10000
91
+ } ) ;
92
+ }
93
+
41
94
ngOnInit ( ) {
42
95
}
43
96
Original file line number Diff line number Diff line change 9
9
'use strict' ;
10
10
11
11
if ( process . env . npm_execpath . indexOf ( 'yarn' ) === - 1 ) {
12
- throw new Error (
13
- 'Please use Yarn instead of NPM to install dependencies. See: https://yarnpkg.com/lang/en/docs/install/' ) ;
12
+ // throw new Error(
13
+ // 'Please use Yarn instead of NPM to install dependencies. See: https://yarnpkg.com/lang/en/docs/install/');
14
14
}
You can’t perform that action at this time.
0 commit comments