When loading data via HTTP, I always get a lot of errors.
If you are loading an Object User, for instance, and you reference user.name, while requesting data via HTTP, console will give you an error, unable to find name attribute on null
, or something like that.
You can fix this putting on the main div a boolean loading
, like:
<div class="main" *ngIf="!loading">
{{ user.name }}
</div>
But I am not satisfied with it, what I want is display an emtpy form, with a loader displaying, and as soon as I have the data, displaying it...
Is there an elegant way to do it ? (not something like if user !== null ...
for each reference )