Html Angular-ng模型无法获取对象数组值
有两个签入和签出动态输入字段。选择日期时,签入和签出时间范围中的“允许用户”字段。问题是无法获取值和数据格式。ng模型无法获取签入和签出值。我想将这样的数据格式保存到数据库中Html Angular-ng模型无法获取对象数组值,html,angular,typescript,Html,Angular,Typescript,有两个签入和签出动态输入字段。选择日期时,签入和签出时间范围中的“允许用户”字段。问题是无法获取值和数据格式。ng模型无法获取签入和签出值。我想将这样的数据格式保存到数据库中 { "days": { "Monday": { "checkin": "09:00", "checkout": "18:00" }, "Tue
{
"days": {
"Monday": {
"checkin": "09:00",
"checkout": "18:00"
},
"Tuesday": {
"checkin": "07:00",
"checkout": "19:00"
}
}
}
这是我的html文件
<div class="row">
<div class="col-lg-12">
<div class="form-group">
<label>Active Days</label>
<ng-select [items]="days" name="days"
bindLabel="id" autofocus loadingText="Loading ..." [multiple]=true
bindValue="id" placeholder="Select Active Days"
[(ngModel)]="attendanceProfile.daysprofile.dayy" >
</ng-select>
</div>
</div>
</div>
<div *ngFor="let days of attendanceProfile.daysprofile.dayy; let i =index ">
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label>Day</label>
<input autocomplete="off" atp-time-picker type="text"
class="form-control" name="days" id="days"
[value]="days"
placeholder="days" disabled />
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label>Check In Time</label>
<input autocomplete="off" atp-time-picker type="text"
class="form-control" name="checkin" id="checkin"
[(ngModel)]="attendanceProfile.daysprofile.dayy[i].checkin" placeholder="chcekin" />
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label>Check Out Time</label>
<input autocomplete="off" type="text"
class="form-control" name="checkout" id="checkout"
[(ngModel)]="attendanceProfile.daysprofile.dayy[i].checkout" placeholder="checkout" />
</div>
</div>
</div>
</div>
[i]。签入
无法获取该值。尝试使用签入[i]
获取值
getNewObject(updateDefault: boolean = false): AttendanceProfile {
let attendanceProfile = new AttendanceProfile();
attendanceProfile.updatedAt = new Date();
attendanceProfile.updatedBy = this.configService.currentUser.fullname;
attendanceProfile.status = 0;
attendanceProfile.daysprofile= {
dayy:{['']:{checkin:{},checkout:{}}}
}