A Simple Mock Component for Angular 2
Christian Nunciato
19912

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.cranium.someMethod();

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.

-sadik

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.