title: Failing angular unit test due to dependency injection in angular7?
body: <p>I have <code>services</code> depdencies in my <code>login</code> component so i placed all dependencies inside  my <code>login</code> component's <code>spec.ts</code> file like this</p>
  
  <pre><code>import { HTTPService, ACLService, HelperService, DataService } from 'app/services';
  </code></pre>
  
  <p>and i am creating <code>login</code> component in <code>.spec</code> file like this</p>
  
  <pre><code>let component: LoginComponent;
  let fixture: ComponentFixture&lt;LoginComponent&gt;;
  let de: DebugElement;
  let el: HTMLElement;
  let loginSpy;
  beforeEach(async(() =&gt; {
      TestBed.configureTestingModule({
          declarations: [LoginComponent],
          imports: [
              BrowserModule,
              FormsModule,
              ReactiveFormsModule,
              HttpClientModule,
              LoadingBarHttpClientModule,
              RouterTestingModule,
              SharedModule,
              ToastrModule.forRoot(),
              CookieModule.forRoot(),
              NgxMaskModule.forRoot()
          ],
          providers: [HTTPService, ACLService, HelperService, CookieService, ToastrService, DataService]
      })
          .compileComponents().then(() =&gt; {
              fixture = TestBed.createComponent(LoginComponent);
              component = fixture.componentInstance;
              component.ngOnInit();
              fixture.detectChanges();
          });
  }));
  
  beforeEach(() =&gt; {
      fixture = TestBed.createComponent(LoginComponent);
      component = fixture.componentInstance;
      component.ngOnInit();
      fixture.detectChanges();
  });
  </code></pre>
  
  <p>But still i am getting error of <code>Dependency Injection</code> of <code>DataService</code> even i added <code>HelperService</code> and <code>DataService</code> in dependencies. </p>
  
  <p>Here is the error i am getting</p>
  
  <p><a href="https://i.stack.imgur.com/KIARF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KIARF.png" alt="enter image description here"></a> </p>
  
  <p>How can i resolve this error?</p>