Hey there, I'm having some trouble pushing an array into my object using Angular. It doesn't seem to be working and I'm not sure what the issue is.
Here's a snippet of my "Job" class that has multiple transactions along with the Transaction class:
export class Job {
Id: number;
transactions: Transaction[];
}
export class Transaction {
transactionId: number;
transactionTime: Date;
}
Within my component, I initialize a new empty Job instance like this... and then after the user inputs some data and clicks a button, I try to add myTransaction to myJob using this code:
myjob = new Job();
myTransaction = new Transaction();
this.myjob.transactions.push(this.myTransaction);
Although no error is thrown, when I trigger the onclick event, it seems like the page is trying to post something and then goes haywire.
Could it be a syntax error on my part?
Thank you!