This commit is contained in:
satyr 2017-11-10 12:24:20 +02:00
parent 7623ec88ed
commit 643495781f
4 changed files with 9 additions and 5 deletions

View File

@ -35,7 +35,9 @@ import * as scroll from '../../assets/jquery.scrollTo.min.js';
selector: 'dynamic-form',
templateUrl: './dynamic-form.component.html',
styleUrls: ['./dynamic-form.component.css'],
providers: [FieldControlService, ServerService, dataModelBuilder]
providers: [
FieldControlService, ServerService, dataModelBuilder
]
})
export class DynamicFormComponent implements OnInit {

View File

@ -1,4 +1,4 @@
<label *ngIf="label" for="{{id}}">{{label}}</label>
<input auto-complete class="form-control" [value]="selectedValue" id="{{id}}" [(ngModel)]="selectedValue" (ngModelChange)="updateByQuery($event)" [source]="values" >
<input auto-complete class="form-control" id="{{id}}" [(ngModel)]="value" (ngModelChange)="updateByQuery($event)" [source]="values" >

View File

@ -29,7 +29,7 @@ export class AutocompleteRemoteComponent implements OnInit, ControlValueAccessor
id : string = UUID.UUID();
@Input() label : string;
@Input() url : string;
@Input() selectedValue : string;
selectedValue : string;
values : any[] = new Array();

View File

@ -36,8 +36,10 @@
[required]="field.required" [pattern] = "field.regex" (ngModelChange) = "toggleVisibility($event, field,false)"> <!--input or change event
on change event the listener is triggered on blur -->
<div *ngSwitchCase="'dropdown'">
<autocomplete-remote *ngIf="field.url" [formControlName]="field.key" [label]="field.label" [url]="field.url" ></autocomplete-remote>
<div *ngSwitchCase="'dropdown'">
<autocomplete-remote *ngIf="field.url" [formControlName]="field.key" [url]="field.url" ></autocomplete-remote>
<select *ngIf="!field.url" class="form-control" [id]="field.key" [formControlName]="field.key" [required]="field.required" (change)="toggleVisibility($event, field, false)">
<option *ngFor="let opt of field.options" [value]="opt._value" >{{opt._label}}</option>
</select>