title: How to set initial value of input field when using vm as controller?
body: <p>I am using john papa style to develop my angular app so there is controller passing data to another controller using service. In second controller, I want to set the input field value when controller get call. I tried to set it like</p>
  
  <blockquote>
    <p>vm.form.mobile = getMob[1].mobile;</p>
  </blockquote>
  
  <p>but this did not work for me.</p>
  
  <p><strong>Here is my second controller</strong></p>
  
  <pre><code> (function ()
      {
          'use strict';
  
          angular
              .module('app.pages.auth.verify-mobile')
              .controller('VerifyMobileController', VerifyMobileController);
  
          /** @ngInject */
          function VerifyMobileController($scope,dataservice,msApi, $state,$mdDialog)
          {
              var vm = this;
              window.onbeforeunload = function() {
                  $state.go('app.pages_auth_login');
              }
              var getMob = dataservice.getData();
              if(typeof getMob !== 'undefined'){
  
                 vm.form.mobile = getMob[1].mobile;
  
              }
  }
  }();
  </code></pre>
  
  <p><strong>Here is html element</strong></p>
  
  <pre><code>&lt;form name="verifyMobileForm" novalidate&gt;
                  &lt;md-input-container class="md-block" md-no-float&gt;
                      &lt;input type="mobile" id="mobile" name="mobile" ng-model="vm.form.mobile" placeholder="Your Mobile number" ng-pattern="/^[789]\d{9}$/" maxlength="10" required&gt;
                      &lt;div ng-messages="verifyMobileForm.mobile.$error" role="alert" multiple&gt;
                          &lt;div ng-message="required"&gt;
                              &lt;span &gt;Mobile no. is required&lt;/span&gt;
                          &lt;/div&gt;
  
                      &lt;/div&gt;
  
                  &lt;/md-input-container&gt;
                  &lt;div class="dialog-demo-content" layout="row" layout-wrap layout-margin layout-align="center"&gt;
                      &lt;md-button type="submit" class="md-raised md-accent submit-button" ng-disabled="verifyMobileForm.$invalid || verifyMobileForm.$pristine" ng-click = "vm.checkMobile($event, document.getElementById('mobile').value)"&gt;
                          Next
                      &lt;/md-button&gt;
                  &lt;/div&gt;
              &lt;/form&gt;
  </code></pre>