0

What if I have an array of events that I want users to be able to rsvp for? Essentially needing the data of the "user" who clicked "rsvp", and the "title" of the "event" that they've rsvp'd for. Could I make a pointer in a Agree class that includes the user's name/id and another pointer that includes the title of the event rsvp'd for? Is there a way to somehow use Angular to add code to the "Agree" class with a form?

User Class:

objectId

username

password

Agree Class:

objectId

username-(current user)

Comments Structure:

Event Class:

objectId-

title-(Need this title)

description-

date-

Please help me understand how to make this work..Thanks!

$scope.getAgree = function(){
var Agree = Parse.Object.extened("Agree");
var query = new Parse.Query("Agree");
query.include("userName");


query.find().then(function(results){
  //Go through each in Array
  var rsvpOjectArray = new Array();
  or(i in results){
  //Set Object to current RsvpObject
  var obj = results[i];
  //Get user
  var userName = obj.get("userName").get("username");    


      rsvpOjectArray.push({

                   user: {userName

                   }
           });    
    }
  });
};



$scope.makeAgree = function(){
var Agree = Parse.Object.extend("Agree");
var agree = new Agree();
var user = new Parse.Object("Agree");


agree.set("userName", Parse.User.current());

agree.save(null, {
  success: function(rsvp) {

   // Hooray! Let them use the app now.
    alert("success!");
   },
    error: function(rsvp, error) {
    // Show the error message somewhere and let the rsvp try                      again.
    alert("Error: " + error.code + " " + error.message);
      }
    });    
 };
7
  • Can you reformat your code & provide class structure which you are using? @user2988188 Commented Aug 20, 2015 at 10:49
  • Ok I did. Should I have a "rsvp" pointer in my event class? Commented Aug 20, 2015 at 14:01
  • Ok maybe users rsvp for an event and I need the event name to be stored in the user. Would I include a pointer in my user class to the event? Commented Aug 20, 2015 at 18:08
  • "Is there a way to somehow use Angular to add code to the "Agree" class with a form?" - It is not related here. Also query.include("userName"); will not work. You have use query.include("_User"); is you are using USER class of Parse. Commented Aug 22, 2015 at 7:11
  • Ok. can you help me with an example that allows users to add objects to a field in the user class when a button is clicked? That would be the ultimate help! Commented Aug 23, 2015 at 17:23

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.