title: Override Angular providers provided in root
body: <p>I import a modal library of ng-bootstrap in a lazy module.</p>
  
  <pre><code>@NgModule({imports: [NgbModalModule]})
  </code></pre>
  
  <p>This library has a <code>NgbModal</code> service provided in root.</p>
  
  <pre><code>@Injectable({providedIn: 'root'})
  class NgbModal {...}
  </code></pre>
  
  <p>I inject it into a component.</p>
  
  <pre><code>constructor(private modal: NgbModal) {}
  </code></pre>
  
  <p>I develop a class extension of that one.</p>
  
  <pre><code>export class CustomNgbModal extends NgbModal{...}
  </code></pre>
  
  <p>How can I override NgbModal type with CustomNgbModal?</p>
  
  <p>Using modules will be </p>
  
  <pre><code>{provide: NgbModal, useClass: CustomNgbModal}
  </code></pre>
  
  <p>but using providedIn root metadata, no clue.</p>
  
  <p><strong>So, how can I override a module which is provided in root?</strong></p>