Skip to content

Instantly share code, notes, and snippets.

@akkumar
Forked from tomastrajan/app.component.ts
Last active December 19, 2017 08:58
Show Gist options
  • Save akkumar/800290b220a9f9d1aace6eed0216ad94 to your computer and use it in GitHub Desktop.
Save akkumar/800290b220a9f9d1aace6eed0216ad94 to your computer and use it in GitHub Desktop.
Angular Material Theming - overlay handling
import { OverlayContainer} from '@angular/cdk/overlay';
export class AppComponent implements OnInit {
// use this to set correct theme class on app holder
// eg: <div [class]="themeClass">...</div>
themeClass: string;
overlayContainer;
constructor(
private overlayContainer: OverlayContainer
) {}
ngOnInit(): void {
// subscribe to some source of theme change events, then...
this.themeClass = newThemeClass;
this.overlayContainer.themeClass = newThemeClass;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment