Vue single file class with member variable - variable is undefined

I have this:

export default class EventForm extends Vue {
 @Prop() eventId?: number | null;
 private eventAttendees: PersonForMeeting[] = []
 
 addAttendee(person: PersonForMeeting) {
  this.eventAttendees.push(person);
 }

              getPeopleFromStore().forEach( (pfm: PersonForMeeting) => {
              if(
                  (pfm.type === "contact" && attendee.contact === pfm.id)
              ||
                  (pfm.type === "user" && attendee.user === pfm.id)
              ) {
                console.log("Adding", JSON.stringify(pfm))
                console.log("THIS", this.eventAttendees) /// <- WHY IS THIS UNDEFINED????
                this.addAttendee(pfm)
              }
            })
}

I get an undefined value at the line noted - why?



from Recent Questions - Stack Overflow https://ift.tt/2JnUozP
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation