Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何显示从后端到角度材质日期选择器字段的日期?_Html_Angular_Typescript_Datepicker_Angular5 - Fatal编程技术网

Html 如何显示从后端到角度材质日期选择器字段的日期?

Html 如何显示从后端到角度材质日期选择器字段的日期?,html,angular,typescript,datepicker,angular5,Html,Angular,Typescript,Datepicker,Angular5,我有一张从后端数据填写的表格,我所有的档案都可以,但是生日档案没有从后端给我带回日期。我使用角材料和日期选择器 我在我的组件中这样填写表格 Birthday: [this.client.Birthday] 这是我的html文件 <div class="mb-24" fxLayout="row"> <mat-form-field fxFlex> <input matInput name="Birthday" [(ngMo

我有一张从后端数据填写的表格,我所有的档案都可以,但是生日档案没有从后端给我带回日期。我使用角材料和日期选择器

我在我的组件中这样填写表格

Birthday: [this.client.Birthday]
这是我的html文件

 <div class="mb-24" fxLayout="row">
          <mat-form-field fxFlex>
            <input matInput name="Birthday" [(ngModel)]="client.Birthday" formControlName="Birthday" placeholder="Ditëlindja"  [matDatepicker]="picker"   tabindex="13">
            <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
            <mat-datepicker #picker></mat-datepicker>
          </mat-form-field>

      </div>


如何从后端获取日期并显示到html,当我发出put请求时,我的日期可以转到后端并更改日期,但当我想在更新表单中查看日期时,它们不会显示。我认为问题在于
[matDatepicker]

您提供的代码中没有足够的信息来确定答案,但我猜当您从后端获得
客户端时,您并没有更新
生日
的值;这是我的呼叫以获取客户端您将
this.client.birth
作为
birth
表单控件的默认值。如果
this.client
在构建表单组时为空,
birth
的值即使在从后端返回数据后也将未定义。您需要执行
this.myF订阅中的ormGroup.get('birth').setValue(client.birth);