How to accept only predefined values in an Angular @Input

Discussão em 'Angular' iniciado por Hely Saul Oberto, Dezembro 15, 2024.

  1. My problem here is that I receive a string value in a as a parameter to a component, but I want to limit the values that can be used as a parameter, just like an enum

    I use

    @Input() type: string = '';


    But the in the component, everything can be introduced to the type property and I need to limit that to just 3 options, as I said before, like an Enum

    Continue reading...

Compartilhe esta Página