gpt4 book ai didi

angular - 以 Angular 拆分和显示字符串值

转载 作者:搜寻专家 更新时间:2023-10-30 22:05:43 27 4
gpt4 key购买 nike

我有一个名为 customer 的 api,我将其显示在 dropdown 中,通过选择特定客户,我将显示所选客户的详细信息(所选 customer 的属性 object)(i,e phone,time) 在这样的输入字段中:

enter image description here

属性time是一个string,我想像这样拆分和显示这个字符串:

enter image description here

我想用拼接的方法拼接,但是我无法实现。

DEMO

最佳答案

在你的list.component.html尝试像这样使用拆分。

<mat-form-field class="timings-days">
<input matInput placeholder="Hours" matInput [value]="customer?.time.split(':')[0]" >
</mat-form-field>
<mat-form-field class="timings-hrs">
<input matInput placeholder="Minutes" matInput [value]="customer?.time.split(':')[1]" >
</mat-form-field>
<mat-form-field class="timings-min">
<input matInput placeholder="Seconds" matInput [value]="customer?.time.split(':')[2]" >
</mat-form-field>

关于angular - 以 Angular 拆分和显示字符串值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54741245/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com