Created
March 18, 2016 13:04
-
-
Save zhentian-wan/bbe86454514c273572a9 to your computer and use it in GitHub Desktop.
Angular 2 Event and ref
This file contains 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 'angular2/core'; | |
import {bootstrap} from 'angular2/bootstrap'; | |
@Component({ | |
selector: 'app', | |
template: ` | |
<div> | |
<input type="text" #myInput/> | |
<button (click)="onClick(myInput.value)">Click Me</button>" | |
</div> | |
` | |
}) | |
class App{ | |
onClick(value: string){ | |
console.log(value); | |
} | |
} | |
bootstrap(App); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment