Skip to content

Instantly share code, notes, and snippets.

@wholypantalones
Last active October 10, 2018 16:46
Show Gist options
  • Save wholypantalones/104705f41fa1b4c9699606630e8cf7f0 to your computer and use it in GitHub Desktop.
Save wholypantalones/104705f41fa1b4c9699606630e8cf7f0 to your computer and use it in GitHub Desktop.
Angular TypeScript set config block callback
// 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