7
7
import { combineLatest , Subject } from 'rxjs' ;
8
8
import { ContentChildComponent } from './content-child.component' ;
9
9
import { ViewChildComponent } from './view-child.component' ;
10
+ import { RxActionFactory } from '@rx-angular/state/actions' ;
10
11
11
12
@Component ( {
12
13
selector : 'rxa-projected-views' ,
@@ -17,7 +18,7 @@ import { ViewChildComponent } from './view-child.component';
17
18
<button
18
19
mat-raised-button
19
20
[unpatch]="['click']"
20
- (click)="trigger$.next ($event.timeStamp)"
21
+ (click)="ui.trigger ($event.timeStamp)"
21
22
>
22
23
tick
23
24
</button>
@@ -26,16 +27,31 @@ import { ViewChildComponent } from './view-child.component';
26
27
test1
27
28
<rxa-view-child>
28
29
<div>
29
- <div *rxLet="renderCallback$; let renderCbVal; parent: false; patchZone: false">
30
+ <div
31
+ *rxLet="
32
+ renderCallback$;
33
+ let renderCbVal;
34
+ parent: false;
35
+ patchZone: false
36
+ "
37
+ >
30
38
renderCallback: {{ renderCbVal }}
31
39
</div>
32
- <div *rxLet="trigger$; renderCallback: renderCallback$;let value; parent: true; patchZone: false">
40
+ <div
41
+ *rxLet="
42
+ ui.trigger$;
43
+ renderCallback: renderCallback$;
44
+ let value;
45
+ parent: true;
46
+ patchZone: false
47
+ "
48
+ >
33
49
<rxa-content-child>
34
50
<div #test>{{ value }}</div>
35
51
</rxa-content-child>
36
52
</div>
37
53
<!--
38
- <div *rxFor="trigger$; let value; parent: true">
54
+ <div *rxFor="ui. trigger$; let value; parent: true">
39
55
<rxa-content-child>
40
56
<div #test>{{ value }}</div>
41
57
</rxa-content-child>
@@ -46,6 +62,7 @@ import { ViewChildComponent } from './view-child.component';
46
62
</rxa-visualizer>
47
63
` ,
48
64
changeDetection : ChangeDetectionStrategy . OnPush ,
65
+ providers : [ RxActionFactory ] ,
49
66
} )
50
67
export class ProjectedViewsComponent {
51
68
@ViewChildren ( 'test' ) set test ( t ) {
@@ -68,8 +85,10 @@ export class ProjectedViewsComponent {
68
85
) ;
69
86
}
70
87
71
- trigger$ = new Subject < any > ( ) ;
88
+ constructor ( private actions : RxActionFactory < { trigger : number } > ) { }
89
+
90
+ ui = this . actions . create ( ) ;
72
91
renderCallback$ = new Subject < any > ( ) ;
73
92
74
- triggerArr$ = combineLatest ( [ this . trigger$ ] ) ;
93
+ triggerArr$ = combineLatest ( [ this . ui . trigger$ ] ) ;
75
94
}
0 commit comments