Skip to content

Commit

Permalink
feat(cdk): fix tuiIsPresent pipe docs
Browse files Browse the repository at this point in the history
  • Loading branch information
theorlovsky committed Nov 1, 2022
1 parent 4053971 commit 59aae7f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {Component} from '@angular/core';
import {FormControl} from '@angular/forms';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import {tuiIsPresent} from '@taiga-ui/cdk';

@Component({
selector: `tui-is-present-example1`,
Expand All @@ -13,13 +12,10 @@ import {tuiIsPresent} from '@taiga-ui/cdk';
})
export class TuiIsPresentExample1 {
readonly items = [`String`, `null`, `undefined`];
readonly value = new FormControl(null);
readonly control = new FormControl(null);

get isPresent(): boolean {
const {value} = this.value;
const objectedValue = this.objectifyValue(value ?? ``);

return tuiIsPresent(objectedValue);
get value(): string | null | undefined {
return this.objectifyValue(this.control.value ?? ``);
}

private objectifyValue(value: string): string | null | undefined {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{{ isPresent }} = isPresent(value);
{{ value | tuiIsPresent }} = value | tuiIsPresent;

<tui-select
class="tui-space_top-2"
[formControl]="value"
[formControl]="control"
>
value
<tui-data-list-wrapper
Expand Down

0 comments on commit 59aae7f

Please sign in to comment.