Last active
January 5, 2018 09:47
-
-
Save kevinchisholm/3e05e990508da67f015b9fd6c3cdb188 to your computer and use it in GitHub Desktop.
How Do I Detect A Text-input Change Event With Angular ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Component} from '@angular/core'; | |
@Component({ | |
selector: 'home', | |
templateUrl: 'src/home/home.html' | |
}) | |
export class HomeComponent { | |
content: string = ""; | |
title: string = ""; | |
changeCount: number = 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div> | |
<h2>Enter some text, and then press the "tab" key.</h2> | |
<p>(or just click outside of the text box)</p> | |
<h3>You have made {{changeCount}} changes so far.</h3> | |
<input | |
type="text" | |
(change)="changeCount = changeCount + 1" | |
placeholder="Enter some text here" /> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment