Skip to content

Commit

Permalink
feat(module:input): provide nzFocus event
Browse files Browse the repository at this point in the history
provide ngFocus event

closes #73
  • Loading branch information
giscafer committed Aug 18, 2017
1 parent 44865c2 commit f7f87f0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/input/nz-input.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
<ng-template [ngIf]="nzType!='textarea'">
<input
(blur)="_emitBlur($event)"
(focus)="_emitFocus($event)"
[attr.id]="nzId"
[disabled]="nzDisabled"
[attr.type]="nzType"
Expand All @@ -40,6 +41,7 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
<ng-template [ngIf]="nzType=='textarea'">
<textarea
(blur)="_emitBlur($event)"
(focus)="_emitFocus($event)"
[attr.id]="nzId"
#inputTextarea
[disabled]="nzDisabled"
Expand Down Expand Up @@ -100,6 +102,7 @@ export class NzInputComponent implements AfterContentInit, ControlValueAccessor
}

@Output() nzBlur: EventEmitter<MouseEvent> = new EventEmitter();
@Output() nzFocus: EventEmitter<MouseEvent> = new EventEmitter();
@ContentChild('addOnBefore') _addOnContentBefore: TemplateRef<any>;
@ContentChild('addOnAfter') _addOnContentAfter: TemplateRef<any>;

Expand Down Expand Up @@ -136,6 +139,10 @@ export class NzInputComponent implements AfterContentInit, ControlValueAccessor
this.nzBlur.emit($event);
}

_emitFocus($event) {
this.nzFocus.emit($event);
}

constructor(private _elementRef: ElementRef, private _renderer: Renderer2) {
this._el = this._elementRef.nativeElement;
}
Expand Down

0 comments on commit f7f87f0

Please sign in to comment.