Skip to content

Instantly share code, notes, and snippets.

@realtomaszkula
Last active May 28, 2018 08:55
Show Gist options
  • Save realtomaszkula/14ebb35f431bfc966531b48188890c57 to your computer and use it in GitHub Desktop.
Save realtomaszkula/14ebb35f431bfc966531b48188890c57 to your computer and use it in GitHub Desktop.
@Directive({
selector: 'img[appProgressiveImage]',
providers: [...]
})
export class ProgressiveImageDirective implements OnInit, Dimensions {
// ...
@HostBinding('style.display') display = Display.flex;
constructor(private imageState: ImageStateService) {}
ngOnInit() {
this.imageState.isLoaded$.subscribe(loaded => {
this.display = loaded ? Display.flex : Display.none;
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment