//In component
console.log('User before passing to service', user); this.userService.addUser(user);
//in service give with below spread operator check once keep the debugger verify at what point it cuasing the issue.
const newUser = { ...user, id: this.users.length + 1 }; this.users.push(newUser);