0

I would like to ask you how I can add a key and a value to an object. I want to get values from textareas, which are generated with the help of ng-repeat, and to push them to an object. courses: {}

With postman it works fine

courses :{
 "C#" : "C# 101",
 "C++": "C++ Advanced"
}

I have a collection called courses. Then with ng-repeat I create a textarea for each course and from this form I would like to put a key and a value to the object courses. key: course_code, value: course_desc. The problem is that I do not know how to store in the in the DB.

<div class="form-group" ng-repeat="course in courses">
    <label for="{{course.name}}">{{course.name}}: </label>
    <textarea  rows="3" ng-model="course.value" class="form-control"></textarea>
</div>

The form

2
  • ng-repeat should look like ng-repeat="(key, value) in yourObject" then simply bind them to a model Commented Feb 14, 2016 at 21:18
  • Nothing in code shown or in question would even relate to using postman. Question is far too broad without more code context Commented Feb 14, 2016 at 21:21

0

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.