0

Let say you have an interface called IData. I would like to create an angular 2 component which accepts any Class that uses IData in the component constructer. Would this be possible or am I heading in the wrong direction.

Thank you in advance.

1 Answer 1

1

I was experimenting with this idea, and this code works: https://github.com/Farata/angular2typescript/blob/master/chapter4/multiple_injectors/app/main_multiple_interface.ts

But this is not a clean cut solution as I'd do with Java interfaces.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank-you very much It worked. Was missing provide(ProductServiceToken, {useClass:MockProductService})

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.