To do:
- select 0 hr only show 15, 30, 45 minutes select
- 1,2,3,4 hr show 0,15, 30, 45 minutes
I want to shorthen this if else statement
onHourChange(hours: number) {
if (hours === 0) {
this.minuteOptions = [
{ value: 15, display: '15' },
{ value: 30, display: '30' },
{ value: 45, display: '45' },
]
} else if (hours === 1) {
this.minuteOptions = [
{ value: 0, display: '00' },
{ value: 15, display: '15' },
{ value: 30, display: '30' },
{ value: 45, display: '45' },
];
}
Use this array to delete or remove from the array when the value 0 is selected
ngOnInit() {
this.hourOptions = [
{ value: 0, display: '0' },
{ value: 1, display: '1' },
{ value: 2, display: '2' },
{ value: 3, display: '3' },
{ value: 4, display: '4' },
];
this.minuteOptions = [
{ value: 0, display: '00' },
{ value: 15, display: '15' },
{ value: 30, display: '30' },
{ value: 45, display: '45' },
];