In my app I have a lot of simple data model classes. For example
export class Client {
first_name: string;
last_name: string;
fullName(): string {
return `${this.first_name} ${this.last_name}`;
}
}
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. Angular docs describe how to share components, providers, directives and pipes. However there is noting about simple (non annotated) classes. The Heros example has an exported model class but it is not used outside of its module.
I guess that the root module should import all model classes. Then feature modules should import just model class declarations. There should be one fullName()
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?
Update: 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?