I have a read-only textarea that should display the 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
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;
}