title: Circular dependency injection angular 2
body: <p>I've been struggling around injecting <code>services</code> into each other. The following blog <a href="http://misko.hevery.com/2008/08/01/circular-dependency-in-constructors-and-dependency-injection/" rel="noreferrer">Circular Dependency in constructors and Dependency Injection</a> is kind of confusing where it says </p>
  
  <blockquote>
    <p>One of the two objects is hiding another object C</p>
  </blockquote>
  
  <p>I get the following error while injecting Service class into each other</p>
  
  <blockquote>
    <p>Can't resolve all parameters for PayrollService: (SiteService, StorageService, 
    SweetAlertService, ?)</p>
  </blockquote>
  
  <pre><code>//abstractmodal.service.ts
  @Injectable()
   export abstract class AbstractModel {
  
     abstract collection = [];
  
     constructor(private siteService: SiteService, private storageService: StorageService,
                  private sweetalertService: SweetAlertService) {}
  
  
     setCollectionEmpty() {
        this.collection = [];
      }
  }
  //account-payable.service.ts
  @Injectable()
  export class AccountPayableService extends AbstractModel {
  
     public collection = [];
  
     constructor(private sS: SiteService,private stS: StorageService, private sws: SweetAlertService,
              private accpPoService: PayablePurchaseOrderService, private attachmentService: AttachmentService,
              private injectorService: InjectorService) { 
           super(sS, stS, sws);
       }
  }
  //injector.service.ts
  @Injectable()
  export class InjectorService {
     constructor(private payrollService: PayrollService) {}
  
     cleanPayrollCollection() {
       this.payrollService.setCollectionEmpty();
     }
  }
  //payroll.service.ts
  @Injectable()
  export class PayrollService extends AbstractModel {
  
     public collection = [];
  
     constructor(private sS: SiteService,private stS: StorageService, private sws: SweetAlertService,
              private accpService: AccountPayableService) { 
      super(sS, stS, sws);
     }
  }
  </code></pre>
  
  <p>Your comments and answered will be appreciated a lot.</p>
  
  <p>Thanks</p>