title: How to dynamically update the input text field value in angular formly?
body: <p>I am using <code>angular-formly</code> in the angular 4 projects.
  The scenario of the work is I have the list of the users and each user has got edit and delete button.</p>
  
  <p>When a user clicks on the edit button a modal is shown up with 2 fields, one is an email address and another one to change the role of the user.</p>
  
  <p>I am using <code>&lt;formly-form&gt;</code> to render the form onto the modal like this.</p>
  
  <p><a href="https://i.stack.imgur.com/GFABf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GFABf.png" alt="enter image description here"></a></p>
  
  <p>When edit button is clicked this modal gets opened, where I wanted to show the email address which is associated with the edit button which is clicked.</p>
  
  <p>Also, I want to keep the role selected in the dropdown for that user.</p>
  
  <p>Here is the formlyfieldconfig </p>
  
  <pre><code>{
          key: 'email',
          className: 'col-sm-4',
          type: 'input',
          defaultValue: '',
          templateOptions: {
              type: 'text',
              label: 'Email',
              disabled: true,
              placeholder: ''
          }
      },
      {
          key: 'role',
          className: 'col-sm-4',
          type: 'select',
          defaultValue: '',
          templateOptions: {
              label: 'Select Role',
              options: [],
              required: true
          }
      }
  </code></pre>
  
  <p>As you can see, above for email field I have kept defaultValue as null, whereas for role field I have kept defaultValue and options as null.</p>
  
  <p>When a user clicks on the edit button, I am dynamically setting the defaultValue and options property which should reflect in the modal popup form.</p>
  
  <pre><code>private edituser(account):void {        
          this.updateModal.show();
          let userData = updateuserdata;
  
          this._PicklistApi.findById('5c45b9e06c0bbc57b5d43a66')
              .subscribe(picklist =&gt; {
                  if(picklist &amp;&amp; picklist['options'].length) {
  
                      _.find(userData,{'key': 'email'})
                          .defaultValue = account.email;
  
                      _.find(userData,{'key': 'role'})
                          .defaultValue = account.role;
  
                          _.find(userData,{'key': 'role'})
                          .templateOptions.options = [...picklist['options']];
  
  
                  }
          });
  
          this.updateuserdata = userData;                      
      }
  </code></pre>
  
  <p><code>this._PicklistApi</code> is a service object which will give me the list of all roles available. </p>
  
  <p><code>updateuserdata</code> will have the actual form field config which is passed to the <code>&lt;formly-form&gt;</code> component in HTML.</p>
  
  <p><code>account</code> parameter is user object having user data including email and role.</p>
  
  <p>when a user clicks on the edit button <code>edituser()</code> gets called, and it sets the select options properly with the available roles.</p>
  
  <p>But, it is not setting up defaultValue for both the email and role fields.</p>
  
  <p>I am not able to understand this behavior as select options are getting set properly whereas it is not setting up the defaultValue for both the fields.</p>
  
  <p>If I do console log then I do see that defaultValue is set for the both of the fields then why it isn't reflecting in the form.</p>