I'm currently working on binding formly select type options with the following code:
fieldGroup: [
{
key: 'TimeOffTypeID',
type: 'select',
className: 'flex-40 padding-10',
templateOptions: {
label: 'نوع مرخصی',
placeholder: 'نوع مرخصی',
required: true,
options: this.getTimeoffType,
valueProp: 'TimeOffTypeID',
labelProp: 'TimeOffTypeName',
},
Additionally,
types$: BehaviorSubject<any[]> = new BehaviorSubject<any[]>([]);
public get getTimeoffType(): Observable<any[]> {
return this.types$.asObservable();
}
and with DataService to retrieve data
getTimeoffTypes() {
this.base
.get(
Controller.TIMEOFFTYPE,
{
TimeOffTypeID: 0,
},
Actions.SEARCH
)
.subscribe(({ result }) => {
console.log(result)
this.types$.next(result);
})
}
The data retrieved seems correct, however it's not being bound to the form select options.