3

I have a static method on my Component class that I am testing, my question is how it is possible to access that method within my spec testing file?

So far I can access a component instance with:

  let fixture = TestBed.createComponent(MyComponent);
  let comp = fixture.componentInstance;
1

1 Answer 1

11

Static methods are not bound to instances of classes. So something like this should work: MyComponent.nameOfStaticMethod(params)

1
  • Sweet! Good luck! Commented Feb 12, 2018 at 18:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.