Data not coming in form when clicked in Edit button in angular











up vote
1
down vote

favorite












The data that is passed to assignmentAudit.component.ts when Edit Button is clicked is :



onEdit(nas:any){
console.log(nas);

this.assignmentAudit.auditorGroupNo=nas.assignmentAudit[0].auditorGroup.groupDesc;
this.assignmentAudit.assignmentDate=nas.assignmentAudit[0].auditorGroup.assignmentDate;
this.assignmentAudit.id=nas.assignmentAudit[0].id;
this.assignmentAudit.selectionNo=nas.selectionId;
this.assignmentAudit.magNo=0;

}


The console.log(nas); data is:
enter image description here



I have the form which has two input field is :



<form name="form" #f="ngForm" (ngSubmit)="f.form.valid &&  onSubmit()" novalidate class="">
<div class="form-group row">
<div class="col-md-6">
<label for="auditorGroup">Auditor Group</label>
<select class="form-control" id="auditorGroup" required [(ngModel)]="assignmentAudit.auditorGroupNo" name="auditorGroup"
#auditorGroup="ngModel"
[ngClass]="{ 'is-invalid': f.submitted && auditorGroup.invalid }"
required
>
<option *ngFor="let title of auditorgroups" [value]="title.auditorGroupId">{{title.groupDesc}}</option>
</select>
<div *ngIf="f.submitted && auditorGroup.invalid" class="invalid-input">
<div *ngIf="auditorGroup.errors?.required">Auditor Group is required</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="assignmentDate">Assignment Date</label>
<input type="date" id="assignmentDate" class="form-control" name="assignmentDate" placeholder="Please enter the Assignment Date" [(ngModel)]="assignmentAudit.assignmentDate" #assignmentDate="ngModel"
[ngClass]="{ 'is-invalid': f.submitted && assignmentDate.invalid }"
required />
<div *ngIf="f.submitted && assignmentDate.invalid" class="invalid-input">
<div *ngIf="assignmentDate.errors?.required">Assignment Date is required</div>
</div>
</div>
</div>
</div>
<button type="submit" style="margin-bottom: 50px;" class="btn btn-success pull-right">Submit</button>
</form>


The forms look simple as :



enter image description here



The action i need is :
enter image description here



I have binded the data using [(ngModel)]="assignmentAudit.assignmentDate" in form and when i put the value on after button click on onEdit() operation this.assignmentAudit.assignmentDate=nas.assignmentAudit[0].auditorGroup.assignmentDate; as it should be binded bidirectionally,the data is not showing automatically in form . What is the problem?










share|improve this question




















  • 1




    Are you able to create a StackBlitz that reproduces the problem?
    – user184994
    Nov 12 at 8:52










  • Do you have just one component for this ?
    – Sunil Singh
    Nov 12 at 9:17










  • yes i have single component
    – ashwin karki
    Nov 12 at 9:25










  • please post auditorgroups
    – firegloves
    Nov 12 at 9:35















up vote
1
down vote

favorite












The data that is passed to assignmentAudit.component.ts when Edit Button is clicked is :



onEdit(nas:any){
console.log(nas);

this.assignmentAudit.auditorGroupNo=nas.assignmentAudit[0].auditorGroup.groupDesc;
this.assignmentAudit.assignmentDate=nas.assignmentAudit[0].auditorGroup.assignmentDate;
this.assignmentAudit.id=nas.assignmentAudit[0].id;
this.assignmentAudit.selectionNo=nas.selectionId;
this.assignmentAudit.magNo=0;

}


The console.log(nas); data is:
enter image description here



I have the form which has two input field is :



<form name="form" #f="ngForm" (ngSubmit)="f.form.valid &&  onSubmit()" novalidate class="">
<div class="form-group row">
<div class="col-md-6">
<label for="auditorGroup">Auditor Group</label>
<select class="form-control" id="auditorGroup" required [(ngModel)]="assignmentAudit.auditorGroupNo" name="auditorGroup"
#auditorGroup="ngModel"
[ngClass]="{ 'is-invalid': f.submitted && auditorGroup.invalid }"
required
>
<option *ngFor="let title of auditorgroups" [value]="title.auditorGroupId">{{title.groupDesc}}</option>
</select>
<div *ngIf="f.submitted && auditorGroup.invalid" class="invalid-input">
<div *ngIf="auditorGroup.errors?.required">Auditor Group is required</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="assignmentDate">Assignment Date</label>
<input type="date" id="assignmentDate" class="form-control" name="assignmentDate" placeholder="Please enter the Assignment Date" [(ngModel)]="assignmentAudit.assignmentDate" #assignmentDate="ngModel"
[ngClass]="{ 'is-invalid': f.submitted && assignmentDate.invalid }"
required />
<div *ngIf="f.submitted && assignmentDate.invalid" class="invalid-input">
<div *ngIf="assignmentDate.errors?.required">Assignment Date is required</div>
</div>
</div>
</div>
</div>
<button type="submit" style="margin-bottom: 50px;" class="btn btn-success pull-right">Submit</button>
</form>


The forms look simple as :



enter image description here



The action i need is :
enter image description here



I have binded the data using [(ngModel)]="assignmentAudit.assignmentDate" in form and when i put the value on after button click on onEdit() operation this.assignmentAudit.assignmentDate=nas.assignmentAudit[0].auditorGroup.assignmentDate; as it should be binded bidirectionally,the data is not showing automatically in form . What is the problem?










share|improve this question




















  • 1




    Are you able to create a StackBlitz that reproduces the problem?
    – user184994
    Nov 12 at 8:52










  • Do you have just one component for this ?
    – Sunil Singh
    Nov 12 at 9:17










  • yes i have single component
    – ashwin karki
    Nov 12 at 9:25










  • please post auditorgroups
    – firegloves
    Nov 12 at 9:35













up vote
1
down vote

favorite









up vote
1
down vote

favorite











The data that is passed to assignmentAudit.component.ts when Edit Button is clicked is :



onEdit(nas:any){
console.log(nas);

this.assignmentAudit.auditorGroupNo=nas.assignmentAudit[0].auditorGroup.groupDesc;
this.assignmentAudit.assignmentDate=nas.assignmentAudit[0].auditorGroup.assignmentDate;
this.assignmentAudit.id=nas.assignmentAudit[0].id;
this.assignmentAudit.selectionNo=nas.selectionId;
this.assignmentAudit.magNo=0;

}


The console.log(nas); data is:
enter image description here



I have the form which has two input field is :



<form name="form" #f="ngForm" (ngSubmit)="f.form.valid &&  onSubmit()" novalidate class="">
<div class="form-group row">
<div class="col-md-6">
<label for="auditorGroup">Auditor Group</label>
<select class="form-control" id="auditorGroup" required [(ngModel)]="assignmentAudit.auditorGroupNo" name="auditorGroup"
#auditorGroup="ngModel"
[ngClass]="{ 'is-invalid': f.submitted && auditorGroup.invalid }"
required
>
<option *ngFor="let title of auditorgroups" [value]="title.auditorGroupId">{{title.groupDesc}}</option>
</select>
<div *ngIf="f.submitted && auditorGroup.invalid" class="invalid-input">
<div *ngIf="auditorGroup.errors?.required">Auditor Group is required</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="assignmentDate">Assignment Date</label>
<input type="date" id="assignmentDate" class="form-control" name="assignmentDate" placeholder="Please enter the Assignment Date" [(ngModel)]="assignmentAudit.assignmentDate" #assignmentDate="ngModel"
[ngClass]="{ 'is-invalid': f.submitted && assignmentDate.invalid }"
required />
<div *ngIf="f.submitted && assignmentDate.invalid" class="invalid-input">
<div *ngIf="assignmentDate.errors?.required">Assignment Date is required</div>
</div>
</div>
</div>
</div>
<button type="submit" style="margin-bottom: 50px;" class="btn btn-success pull-right">Submit</button>
</form>


The forms look simple as :



enter image description here



The action i need is :
enter image description here



I have binded the data using [(ngModel)]="assignmentAudit.assignmentDate" in form and when i put the value on after button click on onEdit() operation this.assignmentAudit.assignmentDate=nas.assignmentAudit[0].auditorGroup.assignmentDate; as it should be binded bidirectionally,the data is not showing automatically in form . What is the problem?










share|improve this question















The data that is passed to assignmentAudit.component.ts when Edit Button is clicked is :



onEdit(nas:any){
console.log(nas);

this.assignmentAudit.auditorGroupNo=nas.assignmentAudit[0].auditorGroup.groupDesc;
this.assignmentAudit.assignmentDate=nas.assignmentAudit[0].auditorGroup.assignmentDate;
this.assignmentAudit.id=nas.assignmentAudit[0].id;
this.assignmentAudit.selectionNo=nas.selectionId;
this.assignmentAudit.magNo=0;

}


The console.log(nas); data is:
enter image description here



I have the form which has two input field is :



<form name="form" #f="ngForm" (ngSubmit)="f.form.valid &&  onSubmit()" novalidate class="">
<div class="form-group row">
<div class="col-md-6">
<label for="auditorGroup">Auditor Group</label>
<select class="form-control" id="auditorGroup" required [(ngModel)]="assignmentAudit.auditorGroupNo" name="auditorGroup"
#auditorGroup="ngModel"
[ngClass]="{ 'is-invalid': f.submitted && auditorGroup.invalid }"
required
>
<option *ngFor="let title of auditorgroups" [value]="title.auditorGroupId">{{title.groupDesc}}</option>
</select>
<div *ngIf="f.submitted && auditorGroup.invalid" class="invalid-input">
<div *ngIf="auditorGroup.errors?.required">Auditor Group is required</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="assignmentDate">Assignment Date</label>
<input type="date" id="assignmentDate" class="form-control" name="assignmentDate" placeholder="Please enter the Assignment Date" [(ngModel)]="assignmentAudit.assignmentDate" #assignmentDate="ngModel"
[ngClass]="{ 'is-invalid': f.submitted && assignmentDate.invalid }"
required />
<div *ngIf="f.submitted && assignmentDate.invalid" class="invalid-input">
<div *ngIf="assignmentDate.errors?.required">Assignment Date is required</div>
</div>
</div>
</div>
</div>
<button type="submit" style="margin-bottom: 50px;" class="btn btn-success pull-right">Submit</button>
</form>


The forms look simple as :



enter image description here



The action i need is :
enter image description here



I have binded the data using [(ngModel)]="assignmentAudit.assignmentDate" in form and when i put the value on after button click on onEdit() operation this.assignmentAudit.assignmentDate=nas.assignmentAudit[0].auditorGroup.assignmentDate; as it should be binded bidirectionally,the data is not showing automatically in form . What is the problem?







javascript angular angular6






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 at 8:58

























asked Nov 12 at 8:41









ashwin karki

1769




1769








  • 1




    Are you able to create a StackBlitz that reproduces the problem?
    – user184994
    Nov 12 at 8:52










  • Do you have just one component for this ?
    – Sunil Singh
    Nov 12 at 9:17










  • yes i have single component
    – ashwin karki
    Nov 12 at 9:25










  • please post auditorgroups
    – firegloves
    Nov 12 at 9:35














  • 1




    Are you able to create a StackBlitz that reproduces the problem?
    – user184994
    Nov 12 at 8:52










  • Do you have just one component for this ?
    – Sunil Singh
    Nov 12 at 9:17










  • yes i have single component
    – ashwin karki
    Nov 12 at 9:25










  • please post auditorgroups
    – firegloves
    Nov 12 at 9:35








1




1




Are you able to create a StackBlitz that reproduces the problem?
– user184994
Nov 12 at 8:52




Are you able to create a StackBlitz that reproduces the problem?
– user184994
Nov 12 at 8:52












Do you have just one component for this ?
– Sunil Singh
Nov 12 at 9:17




Do you have just one component for this ?
– Sunil Singh
Nov 12 at 9:17












yes i have single component
– ashwin karki
Nov 12 at 9:25




yes i have single component
– ashwin karki
Nov 12 at 9:25












please post auditorgroups
– firegloves
Nov 12 at 9:35




please post auditorgroups
– firegloves
Nov 12 at 9:35

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53258457%2fdata-not-coming-in-form-when-clicked-in-edit-button-in-angular%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53258457%2fdata-not-coming-in-form-when-clicked-in-edit-button-in-angular%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

鏡平學校

ꓛꓣだゔៀៅຸ໢ທຮ໕໒ ,ໂ'໥໓າ໼ឨឲ៵៭ៈゎゔit''䖳𥁄卿' ☨₤₨こゎもょの;ꜹꟚꞖꞵꟅꞛေၦေɯ,ɨɡ𛃵𛁹ޝ޳ޠ޾,ޤޒޯ޾𫝒𫠁သ𛅤チョ'サノބޘދ𛁐ᶿᶇᶀᶋᶠ㨑㽹⻮ꧬ꧹؍۩وَؠ㇕㇃㇪ ㇦㇋㇋ṜẰᵡᴠ 軌ᵕ搜۳ٰޗޮ޷ސޯ𫖾𫅀ल, ꙭ꙰ꚅꙁꚊꞻꝔ꟠Ꝭㄤﺟޱސꧨꧼ꧴ꧯꧽ꧲ꧯ'⽹⽭⾁⿞⼳⽋២៩ញណើꩯꩤ꩸ꩮᶻᶺᶧᶂ𫳲𫪭𬸄𫵰𬖩𬫣𬊉ၲ𛅬㕦䬺𫝌𫝼,,𫟖𫞽ហៅ஫㆔ాఆఅꙒꚞꙍ,Ꙟ꙱エ ,ポテ,フࢰࢯ𫟠𫞶 𫝤𫟠ﺕﹱﻜﻣ𪵕𪭸𪻆𪾩𫔷ġ,ŧآꞪ꟥,ꞔꝻ♚☹⛵𛀌ꬷꭞȄƁƪƬșƦǙǗdžƝǯǧⱦⱰꓕꓢႋ神 ဴ၀க௭எ௫ឫោ ' េㇷㇴㇼ神ㇸㇲㇽㇴㇼㇻㇸ'ㇸㇿㇸㇹㇰㆣꓚꓤ₡₧ ㄨㄟ㄂ㄖㄎ໗ツڒذ₶।ऩछएोञयूटक़कयँृी,冬'𛅢𛅥ㇱㇵㇶ𥄥𦒽𠣧𠊓𧢖𥞘𩔋цѰㄠſtʯʭɿʆʗʍʩɷɛ,əʏダヵㄐㄘR{gỚṖḺờṠṫảḙḭᴮᵏᴘᵀᵷᵕᴜᴏᵾq﮲ﲿﴽﭙ軌ﰬﶚﶧ﫲Ҝжюїкӈㇴffצּ﬘﭅﬈軌'ffistfflſtffतभफɳɰʊɲʎ𛁱𛁖𛁮𛀉 𛂯𛀞నఋŀŲ 𫟲𫠖𫞺ຆຆ ໹້໕໗ๆทԊꧢꧠ꧰ꓱ⿝⼑ŎḬẃẖỐẅ ,ờỰỈỗﮊDžȩꭏꭎꬻ꭮ꬿꭖꭥꭅ㇭神 ⾈ꓵꓑ⺄㄄ㄪㄙㄅㄇstA۵䞽ॶ𫞑𫝄㇉㇇゜軌𩜛𩳠Jﻺ‚Üမ႕ႌႊၐၸဓၞၞၡ៸wyvtᶎᶪᶹစဎ꣡꣰꣢꣤ٗ؋لㇳㇾㇻㇱ㆐㆔,,㆟Ⱶヤマފ޼ޝަݿݞݠݷݐ',ݘ,ݪݙݵ𬝉𬜁𫝨𫞘くせぉて¼óû×ó£…𛅑הㄙくԗԀ5606神45,神796'𪤻𫞧ꓐ㄁ㄘɥɺꓵꓲ3''7034׉ⱦⱠˆ“𫝋ȍ,ꩲ軌꩷ꩶꩧꩫఞ۔فڱێظペサ神ナᴦᵑ47 9238їﻂ䐊䔉㠸﬎ffiﬣ,לּᴷᴦᵛᵽ,ᴨᵤ ᵸᵥᴗᵈꚏꚉꚟ⻆rtǟƴ𬎎

Why https connections are so slow when debugging (stepping over) in Java?