jeudi 13 février 2020

Angular Interview Question - What if a "this" switch was a component how would you design it?

So I was asked this question on a interview and apparently I didn't give enough detail/concepts into the answer, so I'd be interested to hear what I may have missed and to help others with such questions.

The Question

If you were to design a component for a wall switch(I.e one that turns on a light), how would you design it and what do you believe the fundamental aspects would be that would make up the component?

My Answer

  • So I noted that an @Input property to control the initial starting state of the component off/on in this case.

  • Internal logic to handle that input event being changed, and then emitting said event out into another component, a light component in this case to trigger the light turning on.

  • Perhaps taking a config object as well to determine extra functionality, depending on how complex you need this component to be.

  • Having input or attribute selectors to style the component.

What big concepts may have I of missed?

Aucun commentaire:

Enregistrer un commentaire