提问人:Ravindra sirvi 提问时间:11/2/2022 最后编辑:ExceptionRavindra sirvi 更新时间:11/2/2022 访问量:862
如何在angular中使用JSON文件将数据保存在数据库中
how to save data in database using JSON file in angular
问:
嗨,我正在尝试将我的 HTML 表单数据保存在数据库中。我为动态字段创建了一个 JSON 文件并绑定了它,但存在一些问题,这就是数据不保存的原因。当我保存数据时,保存的数据与JSON文件中的数据相同,就好像我在输入字段中输入了一些字符串值一样,它没有保存,但原始字符串是相同的。
<div>
<p *ngFor="let item of doclist">
{{ item.label }}
<ejs-checkbox [(ngModel)]="item.value" id="item.value" name="item.value">
{{ item.value }}
</ejs-checkbox>
<ejs-textbox *ngIf="item.value == true && !false"[(ngModel)]="item.comment"
name="item.comment">
{{ item.comment }}
</ejs-textbox>
</p>
</div>
public doclist : {}[] = db;
public doc = JSON.stringify(this.doclist);
this.salesToOpsHand.documentList = this.doc;
`// documentList in that i have to save my all json string value so i write here doc values == documentList`
this is my db.json file
[
{
"name" : "IsSpecifications",
"label" : "isSpecifications() ",
"value" : false,
"type" : "checkbox",
"comment" : ""
},
{
"name" : "IsDrawSchedule",
"label" : "Drawings/Schedules ",
"value" : false,
"type" : "checkbox",
"comment" : ""
},
{
"name" : "TqRfi",
"label" : "TQ’s / RFI’s ",
"value" : false,
"type" : "checkbox",
"comment" : ""
},
{
"name" : "InsEnqReqQouInfor",
"label" : "Install Enquiry / request to quote information ",
"value" : false,
"type" : "checkbox",
"comment" : ""
},
{
"name" : "PanEnqReqQouInfor",
"label" : "Panel Enquiry / request to quote information ",
"value" : false,
"type" : "checkbox",
"comment" : ""
},
{
"name" : "PanSubContQuot",
"label" : "Panel Sub Contractor Quotation ",
"value" : false,
"type" : "checkbox",
"comment" : ""
},
{
"name" : "MccSchedule",
"label" : "MCC Schedules ",
"value" : false,
"type" : "checkbox",
"comment" : ""
},
{
"name" : "ScPackQuot",
"label" : "Other S/C Package Quotations ",
"value" : false,
"type" : "checkbox",
"comment" : ""
},
{
"name" : "OthrdPartyQuot",
"label" : "Other 3rd Party Quotations ",
"value" : false,
"type" : "checkbox",
"comment" : ""
},
{
"name" : "EquipSchedule",
"label" : "Equipment Schedules ",
"value" : false,
"type" : "checkbox",
"comment" : ""
},
{
"name" : "PointSchedul",
"label" : "Points Schedules ",
"value" : false,
"type" : "checkbox",
"comment" : ""
},
{
"name" : "ValveSchedul",
"label" : "Valve Schedules ",
"value" : false,
"type" : "checkbox",
"comment" : ""
},
{
"name" : "IdentRiskOpport",
"label" : "Identifed Risks and Opportunities (INCL. VALUE ENGINEERING) ",
"value" : false,
"type" : "checkbox",
"comment" : ""
},
{
"name" : "InstSubContQuot",
"label" : "Install Sub Contractor Quotation ",
"value" : false,
"type" : "checkbox",
"comment" : ""
}
]
“如果有人知道我在哪里犯了错误,请帮助我
在这里,我尝试使用angular和JSON文件,并将值以字符串的形式保存在服务器端'
答: 暂无答案
评论