在一种形式中,我使用有角材料日期选择器。 OnEdit我想用表单日期修补日期,但显示为空,但日期即将在表单页面上。为了根据ID从数据库中获取记录,请发送onEdit。
我试图给出格式。在数据库日期中以18.4.2019格式存储。
form.patchValue({Date: order.Date});
<mat-form-field>
<input matInput [matDatepicker]="picker"formControlName="dDate" id="Date" readonly (click)="picker.open()"><mat-datepicker-toggle matSuffix [for]="picker"><mat-icon matDatepickerToggleIcon>date_range</mat-icon></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field>
onEdit日期应该是补丁,并且在输入字段中我应该获得该特定记录的日期。
答案 0 :(得分:0)
假设order
是@Input()
,请使用ngOnChanges
对输入值进行反应:
ngOnChanges(changes: SimpleChanges) {
if (changes.order && changes.order.currentValue) {
this.form.patchValue({dDate: this.order.Date});
}
}
在您的标记中,formControlName
是“ dDate
”,与打字稿不同,但它们应该匹配。
答案 1 :(得分:0)
def unnesting(df, explode):
idx = df.index.repeat(df[explode[0]].str.len())
df1 = pd.concat([
pd.DataFrame({x: np.concatenate(df[x].values)}) for x in explode], axis=1)
df1.index = idx
return df1.join(df.drop(explode, 1), how='left')