I am trying to display data in drop down select list using angular formly. The drop down list appear to be blank. Here is the code snippet. Can some please help??
component.ts
this.fields = [
{
key: 'Branch',
type: 'select',
defaultValue: 'develop',
templateOptions: {
required: true,
label: 'Branches',
description: 'Select the Branch to deploy in test',
options: this.artifactory.getArtifacts('star')
}
]
service.ts
getArtifacts(artifact: string) {
let data: Observable<string[]> = of([]);
let artifactType = new HttpParams().set('artifact', artifact)
data = this.httpClient.get<string[]>(`${environment.api}branches`, { params: artifactType }).pipe();
return data;
}
html
<form [formGroup]="form">
<formly-form [form]="form" [fields]="fields"></formly-form>
</form>
</div>
