Last active
October 10, 2018 16:46
-
-
Save wholypantalones/104705f41fa1b4c9699606630e8cf7f0 to your computer and use it in GitHub Desktop.
Angular TypeScript set config block callback
This file contains hidden or 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
// Usage: https://stackblitz.com/edit/angular-config-callback | |
import {Component, OnInit} from '@angular/core'; | |
@Component({ | |
selector: 'app-projects-something', | |
templateUrl: 'app-projects-something.html', | |
styleUrls: ['app-projects-something.scss'] | |
}) | |
export class SomethingSomethingComponent implements OnInit { | |
config: object; | |
constructor() { | |
this.setConfig(() => { | |
// do something once done | |
}); | |
} | |
setConfig(callback: any): void { | |
this.config = { | |
config1: value1, | |
config2: value2 | |
} | |
callback(); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment