Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am new to AngularJS. I have an object passed from another page which is having data and I need use this object and populate the values in respective input controls like label,textbox. After populating the values in respective control, I should be able to Save it to the db.

share|improve this question

put on hold as off-topic by Chris Hayes, Rahil Wazir, Karl-Johan Sjögren, sbaaaang, Andrew Counts 15 hours ago

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Chris Hayes, Rahil Wazir, Karl-Johan Sjögren, Andrew Counts
If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

If I understand you correctly there are a couple of ways you can do this.

To get data from another page, which I'm assuming you can control, use the $http library in angular like this ( from the angular docs).

$http({method: 'GET', url: '/someUrl'}). success(function(data, status, headers, config) { // this callback will be called asynchronously // when the response is available $scope.formData.textbox-data = data; //this is the data that will be in our textbox }). error(function(data, status, headers, config) { // called asynchronously if an error occurs // or server returns response with an error status. });

see https://docs.angularjs.org/api/ng/service/$http.

To insert it into the new page, first create the input form, and tell the computer that we want the value of the textbox to match the value of the variable formData.textbox-data .

<input type="textbox" ng-model="formData.textbox-data" />

Then you add an event listener for the form submit using angularjs (I'll let you google that one) then submit the contents of formData.textbox-data to your server.

Hope that helps

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.