Trying to show object array value in the dropdown. I have one object and it will have 'Car', 'Bus', 'Cycle', 'MotorCycle', 'Train' array value. I want to show the value of this object in each dropdown. Like first dropdown Car array value, second dropdown Bus value, third dropdown Cycle, fourth dropdown MotorCycle value and fifth dropdown Train value. I have used input decorator. So, How to show these value in each dropdown.
main.component.ts:
export class MainComponent implements OnInit {
travals = {
Car: ['Good', 'Bad'],
Bus: ['Supper', 'Coll'],
Cycle: ['Small', 'Big'],
MotorCycle: ['Too Big', 'Scooty'],
Train: ['Special', 'Nomal', 'Super Fast'],
};
vehicle = ['Car', 'Bus', 'Cycle', 'MotorCycle', 'Train'];
constructor() {}
ngOnInit() {}
}
vehicle.component.ts:
export class VehicleComponent implements OnInit {
@Input() data: any = [];
constructor() {}
ngOnInit() {
console.log(this.data);
}
}