ion-google-place icon indicating copy to clipboard operation
ion-google-place copied to clipboard

Multiple fields

Open moretty opened this issue 9 years ago • 5 comments

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?

moretty avatar Apr 11 '15 01:04 moretty

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!

moretty avatar Apr 11 '15 01:04 moretty

OHH GOD. YOU SAVED ME

hfcipriano avatar May 07 '16 17:05 hfcipriano

Really helped me. You are a great man

hfcipriano avatar May 07 '16 17:05 hfcipriano

@moretty thanks dude!

cadrogui avatar Dec 02 '16 14:12 cadrogui

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; }
});

seatechdev avatar Dec 12 '16 08:12 seatechdev