Currently, I am handling button rendering using an enum to determine the type and then displaying different HTML based on that. This is how it's set up:
export interface control {
type: controlType;
}
export enum controlType {
button,
switch,
select
}
Then, I use it like this:
<!--- ko: if: $data.type === 0 -->
PUT CODE HERE
<!-- /ko -->
In an attempt to improve optimization, I started exploring using an object and rendering the code view from a separate file. However, I'm facing difficulties in implementing this approach and would appreciate any assistance. Here's what I have tried so far:
export interface control {
type: {
button: 'folder/button.html',
switch: 'folder/switch.html',
select: 'folder/select.html'
}
}
I thought I could simply do something like this:
<!-- ko compose: { view: $data.type } --> <!-- /ko -->
Unfortunately, that method isn't working as expected, and I'm currently stuck.