title: Lazy loading data of TypeScript classes?
body: <p>I have an Angular application which consumes a RESTful API for data. What I would like to do is structure my data objects such that I only load what I need from the server as it's needed.</p>
  
  <p>For example, if I have a list of <code>Building</code> objects which each have a <code>tenants</code> property I would like the REST API to send me a building object with a <code>int[]</code> of tenant IDs instead of sending an array of <code>Tenant</code> type objects. Then in my app I could list <code>Building</code>s but only show the tenant details when I expand a details panel or something. At that point the app would fetch the individual <code>Tenant</code> objects from the RESTful API by their ID aynchronously. And this would save me from having to fetch <em>all</em> Tenants of <em>all</em> building up-front.</p>
  
  <p>Is this a normal pattern in web applications? I'm having trouble finding any resources on this because I'm not sure what to search for. I would especially appreciate some Angular-specific implementations of the pattern.</p>
  
  <p>Thanks!</p>