I'm trying to send an enum from a parent component to a child component.
This is the enum in question:
export enum Status {
A = 'A',
B = 'B',
C = 'C'
}
Here's the child component code snippet:
@Component({
selector: 'app-enum-selection',
templateUrl: './enum-selection.component.html',
styleUrls: ['./enum-selection.component.scss']
})
export class EnumSelectionComponent implements OnInit {
@Input() enum: Object;
enumKeys=[];
constructor() {
this.enumKeys=Object.keys(this.enum);
}
ngOnInit(): void {
}
}
This is how I'm utilizing the child component within the parent component:
<app-enum-selection [enum]="Status"></app-enum-selection>
However, despite passing the Status enum to the component, the value is always null. Why isn't the Status being transferred to the component? How can I effectively pass an enum from a parent to a child component?