Issues in binding dynamic json to input controls

9 views
Skip to first unread message

Navaneetha Krishnan S

unread,
Jul 23, 2016, 4:31:42 PM7/23/16
to AngularJS

I am not able to bind the dynamic data to the input controls, but static data is bound to the same controls properly. the dynamic data is retreived and I am able to view the data using console.log. but the values are not bound. snapshot of the browser console with the data display enter image description here my static data which bind properly looks like below

const SAMPLE = { queueId: 11, name: 'Mr. Nice' };
constructor(){
this.resultData = SAMPLE;
}

the above hardcoded static data is bound with input controls, but dynamic data which is retreived using Http services is having issues after the http service call, i tried writing to console.log and I can see the content in the browser console. but it is not get bound with input controls I am using TemplateUrl to refer the html file. HTML tag to bind

<input type="text" name="txtQueueID" class="form-control" id="txtQueueID" [(ngModel)]="resultData.queueId" />

Lucas Lacroix

unread,
Jul 25, 2016, 9:31:36 AM7/25/16
to ang...@googlegroups.com
If you are replacing the value of resultData, the input has no way to detect that because it is bound to the old object's queueId member which has NOT changed. The control does not bind to the component's resultData member.

My suggestion is to either A) apply the updates to the resultData object instead of replacing it or B) use a function to get the current queueId value.

-Luke

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.



--
Lucas Lacroix
Computer Scientist
System Technology Division, MEDITECH
Reply all
Reply to author
Forward
0 new messages