Skip to content

Instantly share code, notes, and snippets.

@NishuGoel
Created July 28, 2018 12:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NishuGoel/8923ef867180c59d2516babcc9d3681d to your computer and use it in GitHub Desktop.
Save NishuGoel/8923ef867180c59d2516babcc9d3681d to your computer and use it in GitHub Desktop.
import { Component, EventEmitter, Output } from '@angular/core';
@Component({
selector: 'app-child',
template: `<button class='btn btn-primary' (click)="food()">Click me</button> `
})
export class AppChildComponent {
@Output() foo = new EventEmitter();
index = 0;
food() {
this.index = this.index + 1;
this.foo.emit(this.index);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment