I'm trying to change template with enum values.
TS:
enum NumType {
first, second, third
}
@Component({
selector: 'app-test',
template: `
<div [ngSwitch]="numType">
<a *ngSwitchCase="numType.first" href="first">first</a>
<a *ngSwitchCase="numType.second" href="second">second</a>
<a *ngSwitchCase="numType.third" href="third">third</a>
</div>
`,
})
export class TestElementComponent {
@Input() readonly numType: NumType;
}
HTML:
<app-test
[numType]="numType.first"
></app-info-element>
And then I've got this error:
ERROR TypeError: Cannot read property 'first' of undefined
Can you please tell me what needs to be done to make it work?
Angular 8 used.