3
\$\begingroup\$

Is there a way to improve this code? I'd like to use the enum type PaymentMethoddirectly in the angular template without renaming it to _PaymentMethod.


export enum PaymentMethod {
    CreditCard,
    EFT
}

@Component()
export class PaymentComponent {
    // ReSharper disable once InconsistentNaming
    _PaymentMethod = PaymentMethod;

    paymentMethod: PaymentMethod;
}

<ng-template *ngIf="paymentMethod == _PaymentMethod.CreditCard">
   Enter your card details
</ng-template>
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.