Using the Enum type in Angular library build an error as Can't resolve the enum while importing in other applications.
export enum Appearance {
Basic = 0,
Raised = 1,
Stroked = 2,
Flat = 3,
Icon = 4,
FAB = 5,
MiniFAB = 6,
Link = 7
}
After googling I found that I need to make the Enum as const. export const enum Appearance
. But I can't make the enum const because I am using the Enum inside switch statement in HTML like below
<button mat-raised-button *ngSwitchCase="buttonTypes.Raised">{{field.componentProperty.label}}
</button>
<button mat-raised-button *ngSwitchCase="buttonTypes.Stroked">{{field.componentProperty.label}}
</button>
<button mat-raised-button *ngSwitchCase="buttonTypes.Flat">{{field.componentProperty.label}}
</button>
export class ButtonComponent implements OnInit {
buttonTypes = Appearance ==============> declaring here
constructor() { }
ngOnInit(): void {
}
}
Public-api.ts
export * from './lib/view-models/component-type.enum'
ERROR in ./src/app/user-module/users/car/car-search-filter/car-search-filter.component.ts
Module not found: Error: Can't resolve '@falcon-ng/core/lib/view-models/component-type.enum' in '/Users/macbook/Projects/RentalProjects/RentalUI/src/app/user-module/users/car/car-search-filter'
Is there any better solution ?