Skip to content

Instantly share code, notes, and snippets.

@matthieu-D
Created March 9, 2017 14:46
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 matthieu-D/f2f563ffed0a0ff92552bcdcef12d421 to your computer and use it in GitHub Desktop.
Save matthieu-D/f2f563ffed0a0ff92552bcdcef12d421 to your computer and use it in GitHub Desktop.
import {HostListener, Component} from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
host: {
'(document:click)': 'onDocumentClicked($event)'
}
})
export class AppComponent {
onDocumentClicked(ev) {
console.log('clicked', ev);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment