Skip to content

Commit

Permalink
listUpdates Subject added for filtering list (closes #829)
Browse files Browse the repository at this point in the history
  • Loading branch information
udos86 committed Sep 11, 2018
1 parent 1f64e62 commit 926564f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions packages/core/src/model/input/dynamic-input.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class DynamicInputModel extends DynamicInputControlModel<string | number
@serializable() inputType: string;
files: FileList | null = null;
@serializable() list: string[] | null = null;
listUpdates: BehaviorSubject<string[]>;
listUpdates: BehaviorSubject<string[] | null>;
@serializable() mask: string | RegExp | (string | RegExp)[] | null;
@serializable() max: number | string | Date | null;
@serializable() min: number | string | Date | null;
Expand All @@ -52,8 +52,7 @@ export class DynamicInputModel extends DynamicInputControlModel<string | number
@serializable() step: number | null;

private _listId: string | null = null;



@serializable() readonly type: string = DYNAMIC_FORM_CONTROL_TYPE_INPUT;

constructor(config: DynamicInputModelConfig, layout?: DynamicFormControlLayout) {
Expand All @@ -69,13 +68,15 @@ export class DynamicInputModel extends DynamicInputControlModel<string | number
this.pattern = config.pattern || null;
this.step = isNumber(config.step) ? config.step : null;

this.listUpdates = new BehaviorSubject<string[] | null>(null);
this.listUpdates.subscribe();

if (Array.isArray(config.list)) {

this.list = config.list;
this._listId = `${this.id}List`;

this.listUpdates = new BehaviorSubject<string[]>(this.list);
this.listUpdates.subscribe();
this.listUpdates.next(this.list);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

</mat-form-field>

<mat-autocomplete *ngIf="model.hasList" #matAutocomplete="matAutocomplete"
<mat-autocomplete #matAutocomplete="matAutocomplete"
[autoActiveFirstOption]="model.getAdditional('autoActiveFirstOption', AUTOCOMPLETE_OPTIONS['autoActiveFirstOption'])"
[disableRipple]="model.getAdditional('disableRipple', RIPPLE_OPTIONS && RIPPLE_OPTIONS['disabled'] || false)"
(optionSelected)="onChange($event)">
Expand Down

0 comments on commit 926564f

Please sign in to comment.