export class AppController { $scope: ng.IScope; $autocomplete : google.maps.places.Autocomplete; constructor(private $injector:ng.auto.IInjectorService, public $scope:ng.IScope) { 'ngInject'; this.$injector = $injector; this.$scope = $scope; this.$cordovaGeolocation = this.$injector.get('$cordovaGeolocation'); this.$scope.$on('$ionicView.enter', () => this.onEnter()); } onEnter() { this.$autocomplete = new google.maps.places.Autocomplete( (document.getElementById('topBarSearchInput')), {types: ['geocode']}); } geolocate() { this.$cordovaGeolocation .getCurrentPosition(<ngCordova.IGeolocationOptions>{timeout: 10000, enableHighAccuracy: false}) .then((position) => { var geolocation = { lat: position.coords.latitude, lng: position.coords.longitude }; var circle = new google.maps.Circle({ center: geolocation, radius: position.coords.accuracy }); this.$autocomplete.setBounds(circle.getBounds()); }, (err) => { console.log("unable to find location"); }); } }