title: Angular lazy loaded modules and shared model classes
body: <p>In my app I have a lot of simple data model classes. For example</p>
  
  <pre><code>export class Client {
     first_name: string;
     last_name: string;
     fullName(): string {
         return `${this.first_name} ${this.last_name}`;
     }
  }
  </code></pre>
  
  <p>Notice this is not a ClientService provider class. These are core model classes used across whole application. Now I want to implement lazy loaded ng modules. <a href="https://angular.io/guide/ngmodule#lazy-loading-modules-with-the-router" rel="nofollow noreferrer">Angular docs</a> describe how to share components, providers, directives and pipes. However there is noting about simple (non annotated) classes. The Heros example has <a href="https://github.com/angular/angular/blob/master/aio/content/examples/ngmodule/src/app/hero/hero.service.ts" rel="nofollow noreferrer">an exported model class</a> but it is not used outside of its module.</p>
  
  <p>I guess that the root module should import all model classes. Then feature modules should import just model class declarations. There should be one <code>fullName()</code> method definition after all modules are loaded. Does this mean that I should define a module for model classes? Is it possible to do this for non annotated classes?</p>
  
  <p><strong>Update</strong>: I checked files in the dist directory. It turned out that the Client class methods aren't included into lazy loaded modules (*.chunk.js). But how does this work? How does Angular/Webpack know which classes should packed into the main.bundle.js and which into chunk.js files?</p>