Skip to content

Commit

Permalink
feat: ready emitter for input component
Browse files Browse the repository at this point in the history
  • Loading branch information
felixroos committed Mar 29, 2019
1 parent 7d50c5f commit e2bbf1a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/ui/src/lib/io/input/input.component.ts
Expand Up @@ -25,6 +25,8 @@ export class InputComponent extends DynamicSlotComponent implements ControlValue
@Input() control: AbstractControl;
/** The changed ouput emits whenever the form control of the input changes. */
@Output() changed = new EventEmitter();
/** Emits when the component has been loaded */
@Output() ready = new EventEmitter();
/** Debounce time in ms before the changed event emits. */
@Input() debounce = 0;
/** The instance of field that should be used in the template, can also be a property name. */
Expand Down Expand Up @@ -56,6 +58,8 @@ export class InputComponent extends DynamicSlotComponent implements ControlValue
focus(focus = true) {
if (this.componentInstance && this.componentInstance.focusEvent) {
this.componentInstance.focusEvent.emit(focus);
} else {
console.warn('could not focus component', this.componentInstance);
}
}

Expand Down Expand Up @@ -87,6 +91,7 @@ export class InputComponent extends DynamicSlotComponent implements ControlValue
const componentRef = this.loadComponent(this.component || this.field.input || DefaultInputComponent, data);
this.componentInstance = componentRef.instance;
this.connectControl();
this.ready.emit(this);
if (this.componentInstance.control) {
this.componentInstance.control.valueChanges
.pipe(
Expand Down

0 comments on commit e2bbf1a

Please sign in to comment.