0

I've got a json file that generates the form definitions for each specific form. In the view - I spit out the data something like this

<input ng-data-model="data[value2.Id]" placeholder="{{value2.Label}}" type="text" />

<button ng-click="send_form()" >Submit</button>

In my controller, I've got the following function

$scope.send_form = function() {
    alert($scope.data);
}

When the send_form function is called - i get "undefined" returned back. My question is, how do i handle dynamic form data in Angular JS and get each of the values inserted by the user? Is there a way to get a key/value pair set of data returned? with the ng-data-model has the key and the value inserted by the user as a user? Or how would i handle this specific scenario? Any help would do :)

Thanks :)

1 Answer 1

1

It's just ng-model to bind your input to your scope variable. Or you can use data-ng-model for compliance. Other than that it should work if your data is set up - might help to show an example of how it looks.

Here's a fiddle with some dummy data: https://jsfiddle.net/ba0pj6sv/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.