no message

This commit is contained in:
annabakouli 2018-01-12 11:38:34 +02:00
parent 556b1706d6
commit e4276815a9
6 changed files with 17 additions and 10 deletions

View File

@ -1,5 +1,5 @@
<div [formGroup]="form">
<mat-radio-group formControlName="value">
<mat-radio-group formControlName="value" [required]="field.validationRequired">
<mat-radio-button name="{{field.id}}" value="true">Yes</mat-radio-button>
<br>
<mat-radio-button name="{{field.id}}" value="false">No</mat-radio-button>

View File

@ -1,5 +1,5 @@
<div [formGroup]="form" class="form-group">
<mat-checkbox formControlName="value">{{field.data.label}}</mat-checkbox>
<mat-checkbox formControlName="value" [required]="field.validationRequired">{{field.data.label}}</mat-checkbox>
<!-- <input type="checkbox" formControlName="value"> -->
</div>

View File

@ -1,6 +1,6 @@
<div [formGroup]="form">
<mat-form-field>
<mat-select formControlName="value">
<mat-select formControlName="value" [required]="field.validationRequired">
<mat-option *ngFor="let opt of field.data.options" [value]="opt.value">{{opt.label}}</mat-option>
</mat-select>
<mat-error *ngIf="form.get('value').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>

View File

@ -1,5 +1,5 @@
<div [formGroup]="form">
<mat-radio-group formControlName="value">
<mat-radio-group formControlName="value" [required]="field.validationRequired">
<div *ngFor="let option of this.field.data.options let index = index">
<mat-radio-button [value]="option.value" >{{option.label}}</mat-radio-button>
</div>

View File

@ -11,7 +11,7 @@
<div *ngSwitchCase="'freetext'">
<mat-form-field>
<input matInput formControlName="value" placeholder="{{field.data.label}}">
<input matInput formControlName="value" placeholder="{{field.data.label}}" [required]="field.validationRequired">
<mat-error *ngIf="form.get('value').errors?.required">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
</div>
@ -33,7 +33,7 @@
<div *ngSwitchCase="'textarea'">
<mat-form-field>
<textarea matInput formControlName="value" matTextareaAutosize matAutosizeMinRows="2" matAutosizeMaxRows="10"> </textarea>
<textarea matInput formControlName="value" matTextareaAutosize matAutosizeMinRows="2" matAutosizeMaxRows="10" [required]="field.validationRequired"> </textarea>
<button mat-button *ngIf="form.get('value').value" matSuffix mat-icon-button aria-label="Clear" (click)="this.form.patchValue({'value': ''})">
<mat-icon>close</mat-icon>
</button>

View File

@ -67,19 +67,26 @@ export class AutocompleteComponent implements OnInit {
const valueChanges = this.control.valueChanges.share();
valueChanges.subscribe(searchTerm => {
this.loading = true;
if (this.hasSelectedItem) {
this.resetFormControlValue();
}else{
this.loading = true;
}
});
valueChanges
.debounceTime(this.delay)
.finally(() => this.loading = false)
.distinctUntilChanged()
.switchMap(val => {
//if (this.hasSelectedItem) return [];
if (this.hasSelectedItem) {
this.loading = false;
return [];
}
this.configuration.requestItem.criteria.like = this.control.value;
return this.configuration.callback(this.configuration.requestItem).map(result=>this.filteredItems = (<any[]>result))
return this.configuration.callback(this.configuration.requestItem).map(result => {
this.filteredItems = (<any[]>result)
this.loading = false;
})
}).subscribe()
// this.filteredItems = this.inputField.nativeElement.valueChanges.startWith(null)