A Simple Mock Component for Angular 2
Christian Nunciato

Hi Christian Nunciato
I am trying to access a method from the child component, so how do I access with mock component. My template looks like exactly like yours but in the parent template I am calling something like below.

@ViewChild(CraniumComponent) cranium: CraniumComponent;


This is failing due to the template is overriding and method is not found.

Error message: undefined is not an object (evaluating ‘this.craniumComponent.someMethod’)

Any help would be appreciated.


Like what you read? Give Mohammed Sadik a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.