Skip to content

Injecting Services in Component causes component.spec errors #1116

Closed
@RicardoVaranda

Description

@RicardoVaranda

Please provide us with the following information:

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
    Linux Ubuntu 16.04
  1. Versions. Please run ng --version. If there's nothing outputted, please
    run in a Terminal:
    node --version
    And paste the result here.

angular-cli: 1.0.0-beta.6
node: 6.2.1
os: linux x64

  1. Repro steps. Was this an app that wasn't created using the CLI? What change did you
    do on your code? etc.
    Added a service to the constructor of a new component like:
constructor(private _userService:UserService, private _vmService: VMService) {
}

spec looks like:

describe('Component: WMKS', () => {
  it('should create an instance', () => {
    let component = new WMKSComponent();
    expect(component).toBeTruthy();
  });
});
  1. The log given by the failure. Normally this include a stack trace and some
    more information.

/home/ricardo/WebstormProjects/TrialUI/tmp/broccoli_type_script_compiler-input_base_path-gLdunWag.tmp/0/src/app/components/vm-nav/vm-nav.component.spec.ts (17, 21): Supplied parameters do not match any signature of call target.

  1. Mention any other details that might be useful.

This seems right to me I'm only wondering how I can reference my services without creating a new instance of them to get rid of this error message.


Thanks! We'll be in touch soon.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions