Skip to content

Instantly share code, notes, and snippets.

@benald
Last active May 3, 2019 06:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benald/b9849f660ecc3f40d04bc5a0d28810d3 to your computer and use it in GitHub Desktop.
Save benald/b9849f660ecc3f40d04bc5a0d28810d3 to your computer and use it in GitHub Desktop.
TS:
// OnInit
ngOnInit() {
this.addBodyClass();
}
// Function: Add class to body
addBodyClass() {
const bodyTag = document.body;
bodyTag.classList.add('my-class');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment