【发布时间】:2020-09-10 09:18:56
【问题描述】:
我正在尝试使用此代码正式绑定选择类型选项:
fieldGroup: [
{
key: 'TimeOffTypeID',
type: 'select',
className: 'flex-40 padding-10',
templateOptions: {
label: 'نوع مرخصی',
placeholder: 'نوع مرخصی',
required: true,
options: this.getTimeoffType,
valueProp: 'TimeOffTypeID',
labelProp: 'TimeOffTypeName',
},
和
types$: BehaviorSubject<any[]> = new BehaviorSubject<any[]>([]);
public get getTimeoffType(): Observable<any[]> {
return this.types$.asObservable();
}
和数据服务
getTimeoffTypes() {
this.base
.get(
Controller.TIMEOFFTYPE,
{
TimeOffTypeID: 0,
},
Actions.SEARCH
)
.subscribe(({ result }) => {
console.log(result)
this.types$.next(result);
})
}
结果有我的数据,但是这个数据没有绑定到表单选择选项
【问题讨论】:
标签: angular typescript behaviorsubject angular-formly