File tree Expand file tree Collapse file tree 3 files changed +10
-13
lines changed Expand file tree Collapse file tree 3 files changed +10
-13
lines changed Original file line number Diff line number Diff line change 5
5
@import ' ~bootstrap/scss/root' ;
6
6
@import ' ~bootstrap/scss/buttons' ;
7
7
@import ' ~bootstrap/scss/forms' ;
8
+ @import ' ~bootstrap/scss/custom-forms' ;
8
9
@import ' ~bootstrap/scss/card' ;
9
10
10
11
// prism
Original file line number Diff line number Diff line change 1
1
import { Component } from '@angular/core' ;
2
- import { FormControl , AbstractControl } from '@angular/forms' ;
3
- import { FieldType , FormlyFieldConfig } from '@ngx-formly/core' ;
2
+ import { FieldType } from '@ngx-formly/core' ;
4
3
5
4
@Component ( {
6
5
selector : 'formly-field-checkbox' ,
7
6
template : `
8
7
<label class="custom-control custom-checkbox">
9
8
<input type="checkbox" [formControl]="formControl"
10
- *ngIf="!to.hidden" value="on"
9
+ [attr.invalid]="showError"
10
+ [indeterminate]="model[id] === undefined"
11
11
[formlyAttributes]="field" class="custom-control-input">
12
12
{{ to.label }}
13
+ {{ to.required ? '*' : '' }}
13
14
<span class="custom-control-indicator"></span>
14
15
</label>
15
16
` ,
16
17
} )
17
- export class FormlyFieldCheckbox extends FieldType {
18
- static createControl ( model : any , field : FormlyFieldConfig ) : AbstractControl {
19
- return new FormControl (
20
- { value : model ? 'on' : undefined , disabled : field . templateOptions . disabled } ,
21
- field . validators ? field . validators . validation : undefined ,
22
- field . asyncValidators ? field . asyncValidators . validation : undefined ,
23
- ) ;
24
- }
25
- }
18
+ export class FormlyFieldCheckbox extends FieldType { }
Original file line number Diff line number Diff line change @@ -5,7 +5,10 @@ import { MatCheckbox } from '@angular/material/checkbox';
5
5
@Component ( {
6
6
selector : 'formly-field-mat-checkbox' ,
7
7
template : `
8
- <mat-checkbox [formControl]="formControl" [id]="id" [formlyAttributes]="field">{{ to.label }}</mat-checkbox>
8
+ <mat-checkbox [formControl]="formControl" [id]="id" [formlyAttributes]="field">
9
+ {{ to.label }}
10
+ {{ to.required ? '*' : '' }}
11
+ </mat-checkbox>
9
12
` ,
10
13
} )
11
14
export class FormlyFieldCheckbox extends FieldType implements AfterViewInit {
You can’t perform that action at this time.
0 commit comments