1
1
import { Injectable } from '@angular/core' ;
2
2
import { Actions , Effect < % if ( feature ) { % > , ofType < % } % > } from '@ngrx/effects' ;
3
- < % if ( feature && api ) { % > import { catchError , map , concatMap } from 'rxjs/operators' ; < % } % >
4
- < % if ( feature && api ) { % > import { EMPTY , of } from 'rxjs' ; < % } % >
5
- < % if ( feature && api ) { % > import { Load < %= classify ( name ) % > sFailure , Load < %= classify ( name ) % > sSuccess , < %= classify ( name ) % > ActionTypes , < %= classify ( name ) % > Actions } from '<%= featurePath(group, flat, "actions", dasherize(name)) %><%= dasherize(name) %>.actions' ; < % } % >
6
- < % if ( feature && ! api ) { % > import { < %= classify ( name ) % > ActionTypes } from '<%= featurePath(group, flat, "actions", dasherize(name)) %><%= dasherize(name) %>.actions' ; < % } % >
3
+ < % if ( feature && api ) { % > import { catchError , map , concatMap } from 'rxjs/operators' ;
4
+ import { EMPTY , of } from 'rxjs' ;
5
+ import { Load < %= classify ( name ) % > sFailure , Load < %= classify ( name ) % > sSuccess , < %= classify ( name ) % > ActionTypes , < %= classify ( name ) % > Actions } from '<%= featurePath(group, flat, "actions", dasherize(name)) %><%= dasherize(name) %>.actions' ;
6
+ < % } % >
7
+ < % if ( feature && ! api ) { % > import { concatMap } from 'rxjs/operators' ;
8
+ import { EMPTY } from 'rxjs' ;
9
+ import { < %= classify ( name ) % > ActionTypes , < %= classify ( name ) % > Actions } from '<%= featurePath(group, flat, "actions", dasherize(name)) %><%= dasherize(name) %>.actions' ;
10
+ < % } % >
7
11
8
12
@Injectable ( )
9
13
export class < %= classify ( name ) % > Effects {
@@ -17,13 +21,16 @@ export class <%= classify(name) %>Effects {
17
21
map ( data => new Load < %= classify ( name ) % > sSuccess ( { data } ) ) ,
18
22
catchError ( error => of ( new Load < %= classify ( name ) % > sFailure ( { error } ) ) ) )
19
23
)
20
- ) ;
21
- < % } % >
24
+ ) ; < % } % >
22
25
< % if ( feature && ! api ) { % >
23
26
@Effect ( )
24
- load < %= classify ( name ) % > s$ = this . actions$ . pipe ( ofType ( < %= classify ( name ) % > ActionTypes . Load < %= classify ( name ) % > s ) ) ;
27
+ load < %= classify ( name ) % > s$ = this . actions$ . pipe (
28
+ ofType ( < %= classify ( name ) % > ActionTypes . Load < %= classify ( name ) % > s ) ,
29
+ /** An EMPTY observable only emits completion. Replace with your own observable API request */
30
+ concatMap ( ( ) => EMPTY )
31
+ ) ;
25
32
< % } % >
26
- < % if ( feature && api ) { % >
33
+ < % if ( feature ) { % >
27
34
constructor ( private actions$ : Actions << %= classify ( name ) % > Actions > ) { }
28
35
< % } else { % >
29
36
constructor ( private actions$ : Actions ) { }
0 commit comments