ion-google-place
ion-google-place copied to clipboard
Multiple fields
It's not running as expected when you have two fields. It would be nice if you add support for multiple fields on the same view. Actually when you click the second element, it opens the same result view of the other ion-google-place element.
Is it in your development plants?
Sorry, I finally read all the pull requests and found the answer.
You just need to add the "scope" part in to the main .js like this:
template: '<input type="text" readonly="readonly" class="ion-google-place" autocomplete="off">',
replace: true,
scope: {
ngModel: '=?'
},
and after that, you can implement multiple selectors changing the paramenter "ng-model" in the ion-google-place doom element!
: ) Sorry for the inconveniences. I expect that my comment help other people find it quicker!
OHH GOD. YOU SAVED ME
Really helped me. You are a great man
@moretty thanks dude!
Can someone please post sample code? This is what I am doing in my controller.
$scope.toaddress = { location: '' };
$scope.$watch('toadrress.location', function(mynewVal, myoldVal) {
if (mynewVal.hasOwnProperty('formatted_address')) {
var toaddressname = $scope.toadrress.location.name;
}
});
$scope.fromddress = { location: '' };
$scope.$watch('fromadrress.location', function(newVal, oldVal) {
if (newVal.hasOwnProperty('formatted_address')) {
var fromaddressname = $scope.fromadrress.location.name;
}
});