I'm working on a site with a bunch of form elements that are inserted dynamically from a hard-coded list myFormElements:ElementBase. Each element has a string label, and now I need to make these labels clickable to open a new tab (to an external URL). Ideally I'd like to modify ElementBase to make it clickable somehow, is there way to do this? If not what is the best workaround?
<ng-container
myDynamicField
[field]="myFormElements[0]"
[group]="myForm"
...
>
</ng-container>
export const myFormElements:ElementBase = [
{
id: "some id",
label: 'some label',
type: 'text',
dataType: 'String',
...
},
...
]
export interface ElementBase {
id: string,
label?: string,
type?: string,
dataType?: string,
...
}
[field]is doing with the objects passed). Unless you add in an additional key value pair to represent the url but you would still need to handle the wrapping of the label in an anchor tag and add thehrefattribute, or handle the click event with an onClick handler.