title: angular7 WARNING in Circular dependency detected:
body: <p>I am trying to register a service toa specific module with the help of 'provideIn' attribute in my angular7 app.</p>
  
  <p><strong>test.module.ts</strong></p>
  
  <pre><code>import { NgModule } from '@angular/core';
  import { CommonModule } from '@angular/common';
  import { TestComponent} from './test.component'
  
  @NgModule({
    declarations: [TestComponent],
    imports: [
      CommonModule
    ],
    exports: [TestComponent]
  })
  export class TestModule { }
  </code></pre>
  
  <p><strong>test.component</strong></p>
  
  <pre><code>import { Component, OnInit } from '@angular/core';
  import { TestServiceService } from '../test-service.service';
  @Component({
    selector: 'app-test',
    templateUrl: './test.component.html',
    styleUrls: ['./test.component.scss']
  })
  export class TestComponent implements OnInit {
  
    constructor(public service: TestServiceService) { }
  
    ngOnInit() {
    }
  
  }
  </code></pre>
  
  <p><strong>test-service.ts</strong></p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { TestModule } from './test/test.module';
  
  @Injectable({
    providedIn: TestModule
  })
  export class TestServiceService {
    val = 3;
    constructor() { }
  
    getDetails() {
      return this.val;
    }
  }
  </code></pre>
  
  <p>when I run my app it shows below error</p>
  
  <pre><code>ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[TestComponent -&gt; TestServiceService]: 
    StaticInjectorError(Platform: core)[TestComponent -&gt; TestServiceService]: 
      NullInjectorError: No provider for TestServiceService!
  </code></pre>
  
  <p>when I change provideIn atrribute value as 'root' everything works fine.How can I register a service to specific module with the help of 'provideIn' attribute in angular7?</p>