title: Angular 4 directive error: Can't resolve all parameters for directive
body: <p>I'm totally new to Angular and trying to inject <a href="https://angular.io/guide/structural-directives#the-myunless-property" rel="noreferrer">basic structural directive</a> from Angular guide. Here is my directive:</p>
  
  <pre><code>import { Directive, Input, TemplateRef, ViewContainerRef } from '@angular/core';
  
  @Directive({
    selector: '[pcDropdown]'
  })
  export class DropdownDirective {
    private hasView = false;
  
    constructor(
      private templateRef: TemplateRef&lt;any&gt;,
      private viewContainer: ViewContainerRef,
      private items
    ) { }
  
    @Input() set pcDropdown(condition: boolean) {
      if (!condition &amp;&amp; !this.hasView) {
        this.viewContainer.createEmbeddedView(this.templateRef);
        this.hasView = true;
      } else if (condition &amp;&amp; this.hasView) {
        this.viewContainer.clear();
        this.hasView = false;
      }
    }
  }
  </code></pre>
  
  <p>I'm trying to inject it in my <code>TradeModule</code>:</p>
  
  <pre><code>import { NgModule } from '@angular/core';
  import { CommonModule } from '@angular/common';
  import { SharedModule } from '../shared/shared.module';
  import { TradeComponent } from './trade.component';
  import { DropdownDirective } from '../dropdown.directive/dropdown.directive';
  
  @NgModule({
    imports: [
      CommonModule,
      SharedModule
    ],
    declarations: [TradeComponent, DropdownDirective],
    exports: [DropdownDirective]
  })
  export class TradeModule { }
  </code></pre>
  
  <p>And use the following part of HTML in my <code>TradeComponent</code>'s template:</p>
  
  <pre><code>...
  &lt;p *pcDropdown="true"&gt;
    TEST
  &lt;/p&gt;
  ...
  </code></pre>
  
  <p>But I'm getting the error:</p>
  
  <blockquote>
    <p>Uncaught Error: Can't resolve all parameters for DropdownDirective:
    ([object Object], [object Object], ?).</p>
  </blockquote>
  
  <p>Webstorm is also underlying my <code>@Directive</code> decorator and say the following:</p>
  
  <blockquote>
    <p>Angular: Can't resolve all parameters for DropdownDirective in
    /home/commercialsuicide/Desktop/my-app/src/client/app/dropdown.directive/dropdown.directive.ts:
    ([object Object], [object Object], ?)</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/sy3ee.png" rel="noreferrer"><img src="https://i.stack.imgur.com/sy3ee.png" alt="enter image description here"></a></p>
  
  <p>It also say that my <code>pcDropdown</code> input is unused:</p>
  
  <p><a href="https://i.stack.imgur.com/b40Bk.png" rel="noreferrer"><img src="https://i.stack.imgur.com/b40Bk.png" alt="enter image description here"></a></p>
  
  <p>Need to say, that i already saw <a href="https://stackoverflow.com/a/42717565/6053654">this answer</a> and <code>emitDecoratorMetadata</code> is already set to <code>true</code> in <code>tsconfig.json</code>.</p>
  
  <p>Please, point where I misspelled or forgot to include something in my code.</p>
  
  <p>Many thanks</p>