Created
January 11, 2018 05:54
-
-
Save alvachien/0d5ea7ee185a40bf742325240e5ef01a to your computer and use it in GitHub Desktop.
Workout page size using Angular FlexLayout
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
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