title: Force service instantiation in Angular 2 sub-module (an alternative to AngularJS run block)
body: <p>I have a service in sub-module that wraps some third-party module, instantiates and initializes its service to prepare for use within app. </p>
  
  <pre><code>@Injectable()
  class SubmoduleInitializerService {
      constructor (thirdPartyService: ThirdPartyService) {
        thirdPartyService.initialize(...);
        ...
      }
  }
  
  @NgModule({
      imports: [ThirdPartyModule],
      exports: [ThirdPartyModule],
      providers: [
          ThirdPartyService,
          SubmoduleInitializerService
      ]
  })
  class AppSubmodule {}
  </code></pre>
  
  <p><code>ThirdPartyService</code> isn't injected in app directly but is used by other <code>ThirdPartyModule</code> units, so as long as <code>SubmoduleInitializerService</code> is injected in the same injector as <code>ThirdPartyService</code> or parent injector, everything is fine:</p>
  
  <pre><code>export class AppComponent {
      constructor(
        /* DO NOT REMOVE! BAD THINGS HAPPEN! */
        submoduleInitializerService: SubmoduleInitializerService
      ) {}
      ...
  }
  </code></pre>
  
  <p>It was proven to be a lousy pattern because it is not obvious why <code>SubmoduleInitializerService</code> should stay injected in <code>AppComponent</code> if it's not used neither in class nor in template (was accidentally removed once already).</p>
  
  <p>Basically <code>AppSubmodule</code> module needs an alternative to Angular 1.x <code>angular.module(...).run(...)</code> block.</p>
  
  <p>What are the options here?</p>