This worked for me:
Check the length
property and use ?
to avoid undefined
errors.
So your example would be:
<div class="comeBack_up" *ngIf="previous_info?.length">
UPDATE
The length property only exists on arrays. Since the question was about objects, use Object.getOwnPropertyNames(obj)
to get an array of properties from the object. The example becomes:
<div class="comeBack_up" *ngIf="previous_info && Object.getOwnPropertyNames(previous_info).length > 0">
The previous_info &&
is added to check if the object exists. If it evaluates to true
the next statement checks if the object has at least on proporty. It does not check whether the property has a value.