Skip to content

Instantly share code, notes, and snippets.

@vadimkorr
Last active March 25, 2018 12:23
Show Gist options
  • Select an option

  • Save vadimkorr/5f2e845b16f2de97470990a3542392fe to your computer and use it in GitHub Desktop.

Select an option

Save vadimkorr/5f2e845b16f2de97470990a3542392fe to your computer and use it in GitHub Desktop.
input.component.ts
import { Component, Input, ViewChild, ElementRef } from '@angular/core';
@Component({
selector: 'custom-input',
templateUrl: './input.component.html',
styleUrls: ['./input.component.css']
})
export class InputComponent {
value: string = '';
@Input() type: string = 'text';
@Input() id: string;
@Input() placeholder: string = '';
@ViewChild('inputElement') private _inputElement: ElementRef;
get inputElement(): ElementRef {
return this._inputElement;
}
onChange(event: any) { }
onKeyup(event: any) { }
onBlur(event: any) { }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment