title: Dynamically generate input field type with angular 2 and set the type of the field
body: <p>I am new to angular 2 and trying to dynamically generate a bunch of input fields based on models using angular 2. Some fields are password fields. I want to make the input fields type to password if so. I have written something like this :</p>
  
  <pre><code>&lt;div *ngFor="let field of connector.type.configFields"&gt;
      &lt;label&gt;{{field.name}}&lt;/label&gt;
      &lt;input [(ngModel)]="field.value" /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>now problem is I want to make the field password if the field.name is password
  I am thinking adding something like this to the input </p>
  
  <pre><code>&lt;div *ngFor="let field of connector.type.configFields"&gt;
      &lt;label&gt;{{field.name}}&lt;/label&gt;
      &lt;input [(ngModel)]="field.value" *ngIf="field.name =='Password'" type="password"  /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>now if I do this, All my other fields which are not password simply does not get rendered. Only password field gets rendered. What am I doing wrong.(i am very new to angular2)</p>