Skip to content

Instantly share code, notes, and snippets.

@tkssharma
Created October 7, 2017 11:59
Show Gist options
  • Save tkssharma/f7c994ce5f721a4f605bc17f55a999f4 to your computer and use it in GitHub Desktop.
Save tkssharma/f7c994ce5f721a4f605bc17f55a999f4 to your computer and use it in GitHub Desktop.
import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core';
@Component
({
selector: 'search-bar',
template: '<div class="search-bar" ><input [(ngModel)]="searchText" (change)="handleChange()" /></div>' .
})
export default class SearchBar implements OnInit {
@Output() searchTextChange = new EventEmitter();
searchText: string;
constructor() { }
ngOnInit() { }
handleChange() {
this.searchTextChange.emit({
value: this.searchText
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment