Moddinu
Moddinu

Reputation: 185

Angular 2 component with constructer that use interface

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.

Upvotes: 0

Views: 44

Answers (1)

Yakov Fain
Yakov Fain

Reputation: 12376

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.

Upvotes: 1

Related Questions