I need to pass enum from parent to child component.
I have this enum:
export enum Status {
A = 'A',
B = 'B',
C = 'C'
}
and here is componenmt:
@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 {
}
}
Here how I use child component in parent component:
<app-enum-selection [enum]="Status"></app-enum-selection>
As you can see above I pass enum Status to the component but enum value is always null.
Why Status is not passed to the component? How do I pass enum from parent to child component?