<form (ngSubmit)="onsubmit()">
<div class="col-sm-6">
<div class="form-group" *ngFor="let i of textarray">
<label for="" class="block">{{i.label}} </label>
<input name="name" type="text" class="form-control"
[(ngModel)]="i.label">
</div>
<button class="btn btn-primary">Submit</button>
</div>
</form>
this.entrustservice.getcustomFields().subscribe((response: any) => {
this.auditLogs = response;
console.log( this.auditLogs)
//ignore this lines
function filter(response, query) {
return Object.values(Object.keys(response)
.filter(key => new RegExp('^' + query, 'g').test(key))
.map((key) => response[key]));
}
this.datearray=filter(response,'date');
this.datearray = this.datearray.filter(obj => obj.enabled === true);
this.textarray=filter(response,'text');
this.textarray = this.textarray.filter(obj => obj.enabled === true);
this.dropdownarray=filter(response,'dropdown');
this.dropdownarray = this.dropdownarray.filter(obj => obj.enabled === true);
console.log(filter(response, 'date'));
console.log(filter(response, 'text'));
console.log(filter(response, 'dropdown'));
// this.x=date; ignoe these above lines
this.dataaarays.push(this.auditLogs);
console.log( this.auditLogs);
//saving response to array dynamic form
//insead of response bind class save data
});
}
onsubmit(){
console.log(this.dataaarays)
}
No comments:
Post a Comment