0

At this moment I have the following code on the template (source logic):

<feature-show-error
    *ngSwitchCase="
      state.errorType === ErrorType.INVALID_ARGUMENTS ||
      state.errorType === ErrorType.USER_CANCELLED ||
      state.errorType === ErrorType.OLD_VERSION ||
      state.errorType === ErrorType.F_ERROR ||
      state.errorType === ErrorType.X_ERROR ||
        ? state.errorType
        : ErrorType.GLOBAL_ERROR"
/>

I want to change it to:

<feature-show-error *ngSwitchCase="isError(state.errorType)" />

With the following code on the component:

isError(errorType: ErrorType): boolean {
  const types: ErrorType[] = [
    ErrorType.INVALID_ARGUMENTS,
    ErrorType.USER_CANCELLED,
    ErrorType.OLD_VERSION,
    ErrorType.F_ERROR,
    ErrorType.X_ERROR,
  ];
  return types.includes(errorType);
}

Unfortunately it doesn't work, can someone please help me out?

Calvin
  • 61
  • 10

0 Answers0