79216959

Date: 2024-11-23 01:31:14
Score: 1
Natty:
Report link

I would personally use ngOnChanges as a solution. With the set input function, you would need to create a variable like #_username and validate whether the variable has actually changed or not. Otherwise, you could end up in a loop or trigger the ExpressionChangedAfterItHasBeenChecked error. But I wonder, couldn't the parent component update its signal? This way, you would avoid having an input 'username' in your component and instead receive the signal directly in a computed property, making your component more independent and clean.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Single line (0.5):
  • Low reputation (1):
Posted by: Lucas Araujo