title: Ionic / Angular JS - Input fields not updating correctly after using Geolocation
body: <p>I am building a new App using Ionic / Angular JS. In a specific app tab I am using geolocation to populate 4 fields <em>(street name, street number, lat and long)</em>.</p>
  
  <p>Here is how my controller JS looks like for this specific tab:</p>
  
  <pre><code>.controller('PetitionsCtrl', function($scope, $cordovaGeolocation, $log) {
  
        var posOptions = {timeout: 10000, enableHighAccuracy: false};
        $cordovaGeolocation
        .getCurrentPosition(posOptions)
        .then(function (position) {
          $scope.lat = position.coords.latitude;
          $scope.lng = position.coords.longitude;
  
          $log.log($scope.lat);
          $log.log($scope.lng);
  
          $scope.pLat = {value: $scope.lat};
          $scope.pLng = {value: $scope.lng};
  
          var geocoder = new google.maps.Geocoder();
          var latlng = new google.maps.LatLng($scope.lat, $scope.lng);
          var request = {
            latLng: latlng
          };
  
          geocoder.geocode(request, function(data, status) {
            if (status == google.maps.GeocoderStatus.OK) {
              if (data[0] != null) {
                $log.log("Strada: " + data[0].address_components[1].long_name);
                $log.log("Numar: " + data[0].address_components[0].long_name);
                $log.log("Localitate: " + data[0].address_components[2].long_name);
                $log.log("Adresa: " + data[0].formatted_address);
                $scope.pStreet = {value: data[0].address_components[1].long_name};
                $scope.pNumber = {value: data[0].address_components[0].long_name};
              } else {
                $log.log("Adresa indisponibila");
              }
            }
          })
        });
  })
  </code></pre>
  
  <p>And here is how the HTML part looks like:</p>
  
  <pre><code>&lt;label class="item item-input"&gt;
    &lt;span class="input-label"&gt;Strada&lt;/span&gt;
    &lt;input type="text" ng-model="pStreet.value"&gt;
  &lt;/label&gt;
  &lt;label class="item item-input"&gt;
    &lt;span class="input-label"&gt;Număr&lt;/span&gt;
    &lt;input type="text" ng-model="pNumber.value"&gt;
  &lt;/label&gt;
  &lt;label class="item item-input"&gt;
    &lt;span class="input-label"&gt;Lat&lt;/span&gt;
    &lt;input type="text" ng-model="pLat.value"&gt;
  &lt;/label&gt;
  &lt;label class="item item-input"&gt;
    &lt;span class="input-label"&gt;Lng&lt;/span&gt;
    &lt;input type="text" ng-model="pLng.value"&gt;
  &lt;/label&gt;
  </code></pre>
  
  <p>Now as you can see I am using <code>$log</code> to show the information in the console. Now here comes the weird part... In the console, I am getting all the information correctly shown. Also, the <code>&lt;input type="text" ng-model="pLat.value"&gt;</code> and <code>&lt;input type="text" ng-model="pLng.value"&gt;</code> fields are populated but <strong>NOT</strong> the <code>&lt;input type="text" ng-model="pStreet.value"&gt;</code> and <code>&lt;input type="text" ng-model="pNumber.value"</code>> although, as I said before, the console shows me the right values. Weirder than this, if I go to another tab in my app and return to this tab, all the fields are populated correctly. <strong>What can I do? What am I doing wrong here?</strong></p>