I am following this excellent article to create dynamic components in angular and it works properly. Its passing an array of elements to be rendered dynamically in below format.
config.push(
{
type: 'select',
label: 'Month',
name: 'month',
options: this.monthList,
(change)= selectDayList,
(focus)= selectMonth,
placeholder: 'Select an option',
validation: [Validators.required],
value = -1
},
{
type: 'select',
label: 'Day',
name: 'day',
options: this.dayList,
placeholder: 'Select an option',
validation: [Validators.required]
});
I want to bind dynamic events(like change and focus) passed in array and emit the same with same function-name as passed in array. I am not sure if its feasible or not, as I am new in Angular so want some advice, TIA.
Please suggest some article if available.
Edit: Here dynamic events means it can be any event passed in array, just it need to be present in component's event list. Like change event passed in array's first element so if component has a event called change then it should bind it and emit.
I want to create some kind of generic wrapper, where any dynamic event can perform any action which depends on code present in emitted function only.
Note: For ex. in first dropdown we have passed (change)= selectDayList so it should bind change event and emit selectDayList function