I pass an object to a service, changing a property and passing it back. I expected 'tempcard' and 'card' to hold different values after being changed by the service, but they are identical. I confirmed that the service is changing the value. What am I missing?
output:
new call
card (22925)moved: ---before service
79 to 79
card (22925)moved: ---after service
25 to 25
expected:
card (22925)moved: ---before service
79 to 79
card (22925)moved: ---after service
79 to 25
code:
//card is an object with the board1LaneId set to 79
console.log('new call')
let chs = new CardHelperService(card, this.flatTypes, this.auth);
let tempcard = card;
console.log('card (' + tempcard.id + ')moved: \n' +
tempcard.board1LaneId + ' to ' + card.board1LaneId + '\n')
card = chs.moveLane(dest); //call to my service
console.log('card (' + tempcard.id + ')moved: \n' +
tempcard.board1LaneId + ' to ' + card.board1LaneId + '\n')
service code:
moveLane(dest:string){
this.card.board1LaneId=25
return this.card
}