File tree Expand file tree Collapse file tree 9 files changed +52
-41
lines changed Expand file tree Collapse file tree 9 files changed +52
-41
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 20
20
"prefix" : " app" ,
21
21
"styles" : [
22
22
" assets/vendor.scss" ,
23
- " assets/main.scss" ,
24
- " ../node_modules/ng2-toastr/ng2-toastr.css"
23
+ " assets/main.scss"
25
24
],
26
25
"scripts" : [],
27
26
"environmentSource" : " environments/environment.ts" ,
Original file line number Diff line number Diff line change 30
30
"@ngrx/store-devtools" : " ^5.2.0" ,
31
31
"bootstrap" : " ^4.1.1" ,
32
32
"core-js" : " ^2.5.5" ,
33
- "ng2-toastr " : " ^4.1.2 " ,
34
- "ngrx-data " : " ^1.0.0-beta.11 " ,
33
+ "ngrx-data " : " ^1.0.0-beta.13 " ,
34
+ "ngx-toastr " : " ^8.4.0 " ,
35
35
"rxjs" : " ^5.5.10" ,
36
36
"zone.js" : " ^0.8.19"
37
37
},
Original file line number Diff line number Diff line change @@ -52,19 +52,29 @@ <h5 class="card-title">Welcome to {{ title }}</h5>
52
52
Todo List with SpringBoot backend and Rest API, NgRx Data store solution for CRUD operations
53
53
</ p >
54
54
</ div >
55
- < ul class ="list-group list-group-flush ">
56
- < li *ngFor ="let todo of todos$ | async; let i = index " class ="list-group-item "> < span [innerText] ="todo.title "> </ span >
57
- < button class ="float-right btn btn-sm btn-danger " (click) ="deleteTodo(todo.id) ">
58
- < i class ="fas fa-trash "> </ i >
59
- </ button >
60
- < button class ="float-right btn btn-sm mr-2 " [ngClass] ="{'btn-secondary': !todo.active, 'btn-info': todo.active} " (click) ="updateTodo(todo) ">
61
- < span *ngIf ="todo.active "> < i class ="far fa-check-square fa-lg "> </ i > </ span >
62
- < span *ngIf ="!todo.active "> < i class ="far fa-square fa-lg "> </ i > </ span >
63
- </ button >
64
-
65
- </ li >
66
-
67
- </ ul >
55
+ < table class ="table table-hover table-bordered ">
56
+ < thead class ="thead-light ">
57
+ < tr >
58
+ < th scope ="col "> #</ th >
59
+ < th scope ="col "> Title</ th >
60
+ < th > </ th >
61
+ </ tr >
62
+ </ thead >
63
+ < tbody >
64
+ < tr *ngFor ="let todo of todos$ | async; let i = index ">
65
+ < th scope ="row "> < span [innerText] ="todo.id "> </ span > </ th >
66
+ < td > < span [innerText] ="todo.title "> </ span > </ td >
67
+ < td >
68
+
69
+ < i class ="fas fa-trash float-right text-danger " (click) ="deleteTodo(todo.id) "> </ i >
70
+ < span *ngIf ="todo.active "> < i class ="float-right far fa-check-square fa-lg text-info mr-2 " (click) ="updateTodo(todo) "> </ i > </ span >
71
+ < span *ngIf ="!todo.active "> < i class ="float-right far fa-square fa-lg text-secondary mr-2 " (click) ="updateTodo(todo) "> </ i > </ span >
72
+
73
+ </ td >
74
+ </ tr >
75
+
76
+ </ tbody >
77
+ </ table >
68
78
</ div >
69
79
70
80
< div class ="alert alert-info mt-2 ">
Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ import { TodosService } from './services/todos.service';
4
4
import { Todo } from './dto/todo' ;
5
5
import { Observable } from 'rxjs/Observable' ;
6
6
import { ToastService } from "./services/toast.service" ;
7
- import { ToastsManager } from "ng2-toastr" ;
8
7
9
8
@Component ( {
10
9
selector : 'app-root' ,
@@ -23,19 +22,15 @@ export class AppComponent implements OnInit {
23
22
24
23
constructor (
25
24
private todosService : TodosService ,
26
- private toastService : ToastService ,
27
- private toastr : ToastsManager ,
28
- vcr : ViewContainerRef
25
+ private toastService : ToastService
29
26
) {
30
27
this . todos$ = todosService . entities$ ;
31
- this . toastr . setRootViewContainerRef ( vcr ) ;
32
28
}
33
29
getTodos ( ) {
34
30
this . todosService . getAll ( ) ;
35
31
}
36
32
37
33
ngOnInit ( ) {
38
-
39
34
this . yearNow = new Date ( ) . getFullYear ( ) . toString ( ) ;
40
35
this . appVersion = 'V X.X.X' ;
41
36
this . getTodos ( ) ;
Original file line number Diff line number Diff line change 1
1
import { BrowserModule } from '@angular/platform-browser' ;
2
2
import { NgModule } from '@angular/core' ;
3
3
import { HttpClientModule } from '@angular/common/http' ;
4
- import { ToastModule } from 'ng2-toastr/ng2-toastr' ;
5
4
6
5
import { AppComponent } from './app.component' ;
7
6
import { AppStoreModule } from './store/app-store.module' ;
@@ -10,9 +9,10 @@ import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
10
9
import { CounterComponent } from './counter/counter.component' ;
11
10
import { FormsModule , ReactiveFormsModule } from "@angular/forms" ;
12
11
import { CountervalidComponent } from './counter/countervalid/countervalid.component' ;
13
- import { NoopAnimationsModule } from "@angular/platform-browser/animations" ;
12
+ import { BrowserAnimationsModule } from "@angular/platform-browser/animations" ;
14
13
import { CompModule } from "./comp/comp.module" ;
15
14
import { DirectivesModule } from "./directives/directives.module" ;
15
+ import { ToastrModule } from "ngx-toastr" ;
16
16
17
17
18
18
@NgModule ( {
@@ -24,15 +24,15 @@ import {DirectivesModule} from "./directives/directives.module";
24
24
imports : [
25
25
DirectivesModule ,
26
26
CompModule ,
27
- NoopAnimationsModule ,
28
27
FormsModule ,
29
28
ReactiveFormsModule ,
30
29
HttpClientModule ,
31
30
BrowserModule ,
32
31
AppStoreModule ,
33
32
ServicesModule ,
34
33
NgbModule . forRoot ( ) ,
35
- ToastModule . forRoot ( )
34
+ BrowserAnimationsModule , // required animations module
35
+ ToastrModule . forRoot ( ) , // ToastrModule added
36
36
] ,
37
37
providers : [ ] ,
38
38
bootstrap : [ AppComponent ]
Original file line number Diff line number Diff line change 1
1
import { Injectable } from '@angular/core' ;
2
2
import { EntityActions , OP_ERROR , OP_SUCCESS } from 'ngrx-data' ;
3
- import { ToastsManager } from "ng2 -toastr" ;
3
+ import { ToastrService } from "ngx -toastr" ;
4
4
5
5
@Injectable ( )
6
6
export class ToastService {
7
7
8
- constructor ( actions$ : EntityActions , public toastr : ToastsManager ) {
8
+ constructor ( actions$ : EntityActions , private toastrservice : ToastrService ) {
9
9
actions$
10
10
. where ( ea => ea . op . endsWith ( OP_SUCCESS ) || ea . op . endsWith ( OP_ERROR ) )
11
11
// this service never dies so no need to unsubscribe
12
12
. subscribe ( action =>
13
- this . toastr . success ( `${ action . entityName } action` , 'Success!' )
13
+ // this is a hack against "expression changed" bug listed here https://github.com/scttcper/ngx-toastr/issues/160
14
+ setTimeout ( ( ) => this . toastrservice . success ( `${ action . entityName } action` , 'Success!' ) )
14
15
) ;
15
16
}
16
17
Original file line number Diff line number Diff line change 1
1
@import " variables" ;
2
2
@import " ~bootstrap/scss/bootstrap" ;
3
+
4
+ /* *
5
+ ngx-toastr
6
+ */
7
+ @import " ~ngx-toastr/toastr-bs4-alert" ;
8
+
3
9
/* *
4
10
Font Awesome 5
5
11
*/
You can’t perform that action at this time.
0 commit comments