title: How can a feature module with providers be imported to another feature module with providers?
body: <p>There's a feature module that I kind of like or which I would like to use as a part of my own feature module. The sub-module that I want to include is called <code>SlimLoadingBarModule</code>. I want to use it as a base and use it's functionality by providing my own on the top of it. Additionally my whole app can use my <code>LoadingBarComponent</code> and <code>LoadingBarService</code> and don't need to know about the underlying providers. </p>
  
  <p>So in the end I would like to be able to inject it in my service like this:</p>
  
  <pre class="lang-ts prettyprint-override"><code>@Injectable()
  export class LoadingBarService {
  
      constructor(private slimLoadingBarService: SlimLoadingBarService) {}
  
      start() {}
  
      finish() {}
  
      /**/ 
  
  }
  </code></pre>
  
  <p>And for that I must somehow include it in my module</p>
  
  <pre class="lang-ts prettyprint-override"><code>import { NgModule, ModuleWithProviders } from '@angular/core';
  
  import { SlimLoadingBarModule } from 'ng2-slim-loading-bar';
  
  import { LoadingBarComponent } from './loading-bar.component';
  import { LoadingBarService } from './loading-bar.service';
  
  @NgModule({
      imports: [ SlimLoadingBarModule.forRoot() ],
      declarations: [ LoadingBarComponent ],
      exports: [ LoadingBarComponent ]
  })
  export class LoadingBarModule {
  
      static forRoot(): ModuleWithProviders {
          return {
              ngModule: LoadingBarModule,
              providers: [ LoadingBarService ]
          };
      }
  
  }
  </code></pre>
  
  <p>And the template simply contains the tag for <code>SlimLoadingBar</code></p>
  
  <hr>
  
  <p><strong>Problem</strong></p>
  
  <p>Although my own service is singleton throughout my modules, I can't make the <code>SlimLoadingBarService</code> to be a singleton. I always get exactly two instances and if I don't inject it into my service I get 1, but then I can't use it. </p>
  
  <p>Additionally I know my service and component is working, as I got these to work once somehow, but I didn't find the modules and imports to be logical enough to keep them like this.</p>
  
  <p>I Have tried various solutions, through <code>SharedModule</code>, through <code>AppModule</code> but whatever I seem to do, when I try to inject it into my <code>LoadingBarService</code> I have 2 instances! </p>
  
  <p>But I feel it shouldn't be impossible for a feature module to use some additional underlying providers and perhaps hiding them from the rest of the application? Is it even possible? If so, then what am I doing wrong?</p>