I am taking question data from parse.com qustion table. I need to save the 
answer with question id. But when I am accessing  quesID in JS file, it 
dispays : {{dt.quesID}} instead of question id itself. I am inistializing 
the value in ng-init tag: init="ans.quesID='{{dt.id}} . Is there any 
mistake in it ???
              

This is html file:    

             
 <form>
             <div class="row ques"  style="margin-bottom: 0px" 
 ng-repeat="dt in data" id="question{{$index + 1}}"  >
             <div class="col-lg-9 col-centered" ng-if="my_index === $index">
            <div class="col-lg-12">
                    <div>It is a sample description, that provides 
instruction of how to answer above question..</div>                         
                                   
                    <div ng-if="$index > -1 && $index < 2">
                     <input maxlength="100" type="number" 
required="required"  ng-model="ans.newAns" class="form-control" /> 
                                             
                     <input type="text" ng-model="ans.quesID" 
ng-init="ans.quesID='{{dt.id}}'" />                                         
             

                     <div><button type="submit" style="margin: 20px 0 0 0; 
padding:0 70px" class="btn-survey"  ng-click="addAns(ans);next()" > 
Next</button></div>
                          </div> 

                     </div>
                 </div>
               </div>
    </form>

               
This is js file:

   $scope.addAns = function (form) {  
 alert("quesID: "+form.quesID);      
 var AnsObject = Parse.Object.extend("answer");     
   var ansObject = new AnsObject();       
  ansObject.set("answer", form.newAns.toString());
   ansObject.set("questionID", form.quesID);
        ansObject.save(null, {
            success: function (testObject) {
            },
            error: function (testObject, error) {
                alert('Failed to create new object, with error code: ' + 
error.message);           
        });
        }
    };
  

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to