title: What happens if Same Provider registered in two modules and if a module imports both the modules
body: <p>I have made <code>LogService</code> as provider in two modules. Now in my AppModule I am importing both the modules. Since we have registered provider at two modules, I think we will have two instances of <code>LogService</code> at two module levels. Now when we import the both in the AppModule which instance are we going to use? Will it be the first imported module provider or last imported module provider? Please take a look at the following code</p>
  
  <pre><code>log.service.ts
  --------------
  @Injectable()
  export class LogService {
     private data: number = 45;
  }
  
  log.module.ts
  -------------
  import {LogService} from "./log.service"; 
  @NgModule({providers : [LogService]})
  export class LogModule{}
  
  logger.module.ts
  ----------------
  import {LogService} from "./log.service"; 
  @NgModule({providers : [LogService]})
  export class LoggerModule{}
  
  app.module.ts
  -------------
  @NgModule({imports : [BrowserModule, LogModule, LoggerModule]})
  export class AppModule{}
  
  app.component.ts
  ----------------
  import {LogService} from "./log.service"; 
  @Component({})
  export class AppComponent{
     // will the instance be from LogModule or LoggerModule?
     // If I want to explicitly get the instance of LoggerModule then How do I specify?
     constructor(private logService: LogService){}
  }
  </code></pre>