title: Angular 5 - Stop errors from undefined object before loading data
body: <p>What's the best way to prevent errors in console from objects that are still undefined?</p>
  
  <p>Let's say I have this</p>
  
  <pre><code>name : string;
  constructor(private data: DataService) {
  this.data.name.subscribe(res =&gt; this.name = res);
  }
  </code></pre>
  
  <p>Inside my html I have this</p>
  
  <pre><code>&lt;p&gt; {{name}}&lt;/p&gt;
  </code></pre>
  
  <p>When I load the page I get <code>_co.name</code> is not defined, but the page still shows the value of <code>name</code>. The component is loading before getting the data I suppose.</p>
  
  <p>What's the best approach to prevent this?</p>
  
  <p>I saw <code>ngIf</code> is not <code>null</code> or something like that, is an option. But then I saw something about Resolve.</p>