title: Dynamic forms Angular2. Conditional field visibility
body: <p>I would like to show a field only when there is a concrete value in other one using dynamic forms.</p>
  
  <p>I've defined a new property "condition: boolean" for the class QuestionBase (app/question-base.ts)
  My intention is to show a field dinamically when other one has a concrete value. I named this field "Conditional"</p>
  
  <p>I think that I must include any sentence like *ngIf in the  label in app/dynamic-form-question.component.html for injecting a personalized condition, but I'm stucked. 
  *ngIf doesn't evaluate question.condition when condition is defined as string. I can't find any solution to define, as a boolean, a expression in app/question.service.ts.</p>
  
  <pre><code>e.g.
        new TextboxQuestion({
          key: 'conditional',
          label: 'Conditional Field',
          type: 'text',
          condition: brave.value == solid, (something like this, brave is other field in this form)
          order: 5
        })
  </code></pre>
  
  <p>Then a would read the condition expression for change visibility.
        </p>
  
  <pre><code>    &lt;input *ngSwitchCase="'textbox'" [formControlName]="question.key"
              [id]="question.key" [type]="question.type"&gt;
  
      &lt;select [id]="question.key" *ngSwitchCase="'dropdown'" [formControlName]="question.key"&gt;
        &lt;option *ngFor="let opt of question.options" [value]="opt.key"&gt;{{opt.value}}&lt;/option&gt;
      &lt;/select&gt;
  
    &lt;/div&gt; 
  </code></pre>
  
  <p>Here is a <a href="http://plnkr.co/edit/xfDbICjmCGURVk6szrwp?p=preview" rel="nofollow">plunker</a>. The example is from the angular2 tutorial, with some changes.<br>
  I searched a lot about dynamic forms, it's probably because I am a beginner in Angular2.  </p>
  
  <p>Many thanks</p>