title: How to test component with a @Inject text in the constructor in Angular
body: <p>Angular 6, I declare some injected variables in the constructor of my component, But I don't know how to configure the injected value in the unit test file, when I run <code>ng test</code>and it gives the following error:</p>
  
  <blockquote>
    <p>Error: StaticInjectorError(DynamicTestModule)[title]:<br>
    StaticInjectorError(Platform: core)[title]: 
        NullInjectorError: No provider for title!</p>
  </blockquote>
  
  <p>//My component</p>
  
  <pre><code>export class ConfirmModalComponent extends BaseModal implements OnInit {
    choosedCandidates: Array&lt;any&gt; = [];
  
    constructor(
        @Inject('title') public title,//injected variable
        protected modalService: ModalService
    ) {
        super();
    }
  
    ngOnInit() {
    }
    ....
  }
  //spec file of my component
  beforeEach(async(() =&gt; {
    TestBed.configureTestingModule({
        declarations: [ DelInterviewerConfirmModalComponent ],
        imports: [ CheckboxModule, TranslateModule ],
        providers: [ 
          { provide: title, useValue: 'modal title' },
          ModalService, 
          RequisitionDetailService ],
      schemas: [ CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA ],
    })
  .compileComponents();
  }));
  
  beforeEach(() =&gt; {
    fixture = TestBed.createComponent(DelInterviewerConfirmModalComponent);
    component = fixture.componentInstance;
    component.title = "test";
    fixture.detectChanges();
  });
  
  it('should create', () =&gt; {
    expect(component).toBeTruthy();
  });
  </code></pre>
  
  <p>I wonder if anybody meets the same problem and how to resolve the errors, thanks in advance.</p>