C
C
Coder3212017-02-26 03:43:08
Angular
Coder321, 2017-02-26 03:43:08

What type is the component?

I have a component whose parameters are passed to another component. Parameters need to be strongly-typed. How do components have a type in Angular 2?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
_
_ _, 2017-02-26
@AMar4enko

A component in Angular2 is a function.
UPD:
If you want a normally typed parameter for a component, then

interface BaseComponent {}

class MyComponent implements BaseComponent {}

component: BaseComponent = MyComponent

because By and large, Angular doesn’t care what you give him there, but you do it only so that you don’t shoot yourself in the foot

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question