I tend to avoid setters with the inputs if the inputs have dependency on other inputs because then the order inputs to the components matter.
@Component({...}) class Component { @Input() url: Url; @Input() set users(users: Array<User>) { this._users = users.map((user) => { return user.avatar = this.url.baseUrl + user.avatar; }); } private _users: Array<User>; } <component [url]="'someurl'" [users]=users /> //will work fine <component [users]=users [url]="'someurl'" /> //will not work fine
see this link for further details: medium.com/generic-ui/a-deep-dive-...
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I tend to avoid setters with the inputs if the inputs have dependency on other inputs because then the order inputs to the components matter.
see this link for further details: medium.com/generic-ui/a-deep-dive-...