-
Notifications
You must be signed in to change notification settings - Fork 477
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(kit):
InputDateTime
validators not triggered when value change (#…
- Loading branch information
Showing
7 changed files
with
94 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
projects/demo/src/modules/components/input-date-time/examples/6/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<tui-input-date-time [formControl]="control">Choose date and time</tui-input-date-time> | ||
<tui-error | ||
[error]="[] | tuiFieldError | async" | ||
[formControl]="control" | ||
></tui-error> | ||
|
||
<p>Form value:</p> | ||
|
||
<pre><code>{{ control.value | json }}</code></pre> |
28 changes: 28 additions & 0 deletions
28
projects/demo/src/modules/components/input-date-time/examples/6/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import {Component} from '@angular/core'; | ||
import { | ||
AbstractControl, | ||
FormControl, | ||
ValidationErrors, | ||
ValidatorFn, | ||
} from '@angular/forms'; | ||
import {changeDetection} from '@demo/emulate/change-detection'; | ||
import {encapsulation} from '@demo/emulate/encapsulation'; | ||
import {TuiDay} from '@taiga-ui/cdk'; | ||
|
||
const completeDateTimeValidator: ValidatorFn = ( | ||
control: AbstractControl, | ||
): ValidationErrors | null => | ||
control.value.every(Boolean) ? null : {incompleteDateTime: true}; | ||
|
||
@Component({ | ||
selector: 'tui-input-date-time-example-6', | ||
templateUrl: './index.html', | ||
encapsulation, | ||
changeDetection, | ||
}) | ||
export class TuiInputDateTimeExample6 { | ||
readonly control = new FormControl( | ||
[new TuiDay(2017, 2, 15), null], | ||
completeDateTimeValidator, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters