I know there are a lot of same questions already posted in stack-overflow and tried different solutions to avoid the run-time error but None of them are working for me.
Try this, to call your code in ngOnInit()
someMethod() // emitted method call from output { // Your code } ngOnInit(){ someMethod(); // call here your error will be gone }