File tree Expand file tree Collapse file tree 1 file changed +20
-15
lines changed
libs/template/experimental/if/src/lib Expand file tree Collapse file tree 1 file changed +20
-15
lines changed Original file line number Diff line number Diff line change @@ -8,33 +8,31 @@ import {
8
8
OnInit ,
9
9
SimpleChanges ,
10
10
TemplateRef ,
11
- ViewContainerRef ,
11
+ ViewContainerRef
12
12
} from '@angular/core' ;
13
+ import { coerceAllFactory , coerceObservable } from '@rx-angular/cdk/coercing' ;
14
+ import {
15
+ createTemplateNotifier ,
16
+ RxNotificationKind
17
+ } from '@rx-angular/cdk/notifications' ;
18
+ import { RxStrategyProvider } from '@rx-angular/cdk/render-strategies' ;
19
+ import {
20
+ createTemplateManager ,
21
+ RxTemplateManager
22
+ } from '@rx-angular/cdk/template' ;
13
23
import {
14
24
NextObserver ,
15
25
Observable ,
16
26
ReplaySubject ,
17
27
Subject ,
18
- Subscription ,
28
+ Subscription
19
29
} from 'rxjs' ;
20
30
import { mergeAll } from 'rxjs/operators' ;
21
31
import {
22
32
RxIfTemplateNames ,
23
33
rxIfTemplateNames ,
24
- RxIfViewContext ,
34
+ RxIfViewContext
25
35
} from './model/index' ;
26
- import { coerceBooleanProperty } from '@angular/cdk/coercion' ;
27
- import {
28
- createTemplateManager ,
29
- RxTemplateManager ,
30
- } from '@rx-angular/cdk/template' ;
31
- import { RxStrategyProvider } from '@rx-angular/cdk/render-strategies' ;
32
- import { coerceAllFactory } from '@rx-angular/cdk/coercing' ;
33
- import {
34
- createTemplateNotifier ,
35
- RxNotificationKind ,
36
- } from '@rx-angular/cdk/notifications' ;
37
- import { coerceObservable } from '@rx-angular/cdk/coercing' ;
38
36
39
37
@Directive ( {
40
38
selector : '[rxIf]' ,
@@ -200,3 +198,10 @@ function updateViewContext<T>(
200
198
view . context [ k ] = context [ k ] ;
201
199
} ) ;
202
200
}
201
+
202
+ /**
203
+ * Coerces a data-bound value (typically a string) to a boolean.
204
+ */
205
+ function coerceBooleanProperty ( value : any ) : boolean {
206
+ return value != null && `${ value } ` !== 'false' ;
207
+ }
You can’t perform that action at this time.
0 commit comments