Created
November 11, 2017 22:07
-
-
Save justindujardin/0e9688be49b7d324a88d4a827669bbc4 to your computer and use it in GitHub Desktop.
canvas component
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 { | |
AfterViewInit, Component, ElementRef, OnDestroy, ViewChild | |
} from '@angular/core'; | |
@Component({ | |
selector: 'cool-gl', | |
template: ` | |
<canvas #lookupTag></canvas>` | |
}) | |
export class CoolGLComponent implements AfterViewInit, OnDestroy { | |
@ViewChild('lookupTag') canvasRef: ElementRef; | |
// Called after the view is totally initialized and the "View query" | |
// from `@Viewchild` has resolved. | |
ngAfterViewInit(): void { | |
const canvas: HTMLCanvasElement = this.canvasRef.nativeElement; | |
console.log('found yer canv(ass) like whoa: ' + canvas); | |
// Do yer wiring up three.js here. | |
} | |
ngOnDestroy(): void { | |
// Clean up your things, jerk. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment