Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alvachien/0d5ea7ee185a40bf742325240e5ef01a to your computer and use it in GitHub Desktop.
Save alvachien/0d5ea7ee185a40bf742325240e5ef01a to your computer and use it in GitHub Desktop.
Workout page size using Angular FlexLayout
view: Array<number> = [];
constructor(private media: ObservableMedia) {}
ngOnInit() {
this.media.asObservable()
.pipe(takeUntil(this.ngUnsubscribe))
.subscribe((change: MediaChange) => {
this.changeGraphSize();
});
this.changeGraphSize();
}
private changeGraphSize() {
let graphSize = 0;
if (this.media.isActive('xs')) {
graphSize = 150;
} else if (this.media.isActive('sm')) {
graphSize = 300;
} else if (this.media.isActive('md')) {
graphSize = 350;
} else {
graphSize = 400;
}
this.view = [graphSize, graphSize];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment