If I have an expression {{ x }}
and x is undefined
or null
, then how can I display a placeholder for it?
I provided one solution
Implementing default-ish filters works, but if you're using only numbers you can use angular's own number filter
If the input is null or undefined, it will just be returned. If the input is infinite (Infinity or -Infinity), the Infinity symbol '∞' or '-∞' is returned, respectively. If the input is not a number an empty string is returned.
{{ (val | number ) || "Number not provided"}}