Last active
October 21, 2016 18:30
-
-
Save wKoza/c4922a665cf776998bc755ce1eaa2890 to your computer and use it in GitHub Desktop.
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, Output, EventEmitter} from '@angular/core'; | |
@Component({ | |
selector: 'app-comp2', | |
template: ` | |
<button (click)="decrement()" > - </button> | |
<button (click)="increment()"> + </button> | |
` | |
}) | |
export class Comp2Component { | |
counterValue: number = 0; | |
@Output() counterChange = new EventEmitter(); | |
increment() { | |
this.counterValue++; | |
this.counterChange.emit({ | |
value: this.counterValue | |
}); | |
} | |
decrement() { | |
this.counterValue--; | |
this.counterChange.emit({ | |
value: this.counterValue | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment