I have a readonly-textarea that should display values of a certain object.
If the object is undefined, it will show "undefined" inside the textarea as well instead of the placeholder. I specifically want to use a placeholder instead of returning the values inside my function when the object is undefined. How can i achieve this?
https://stackblitz.com/edit/primeng-inputtextarea-demo-vbm6zp?file=src%2Fapp%2Fapp.component.html
>Solution :
Returns an empty string or null instead of undefined will show the placeholder value.
showSomething(person: Person): string {
if(!person) {
return null;
}
return person.name + ' ' + person.surname;
}