Angular2 routing, how to avoid errors while data is loading
<p>I have a route:</p>

<pre><code>@RouteConfig ([
    {path: '/dn/', name: 'Details', component: DetailsComponent}
])
</code></pre>

<p>DetailsComponent loads data in the ngOnInit method.</p>

<p>Data is shown in the components template with constructs like</p>

<pre><code>{{data.prop1.prop2}}
</code></pre>

<p>But as long as the data is not loaded, I get errors because data.prop1.prop2 does not yet exist.</p>

<p>What is the preferred way in angular2 to solve this problem? With</p>

<pre><code>&lt;span *ngIf="data"&gt;{{data.prop1.prop2}}&lt;/span&gt;
</code></pre>

<p>or with AsyncRoute, or by setting the template dynamically?</p>