Skip to content

Instantly share code, notes, and snippets.

@zhentian-wan
Created March 18, 2016 13:04
Show Gist options
  • Save zhentian-wan/bbe86454514c273572a9 to your computer and use it in GitHub Desktop.
Save zhentian-wan/bbe86454514c273572a9 to your computer and use it in GitHub Desktop.
Angular 2 Event and ref
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