Skip to content

thematan/angular2-google-place-autocomplete

 
 

Repository files navigation

Angular2

##Sample output google-search

The sources for this package are in (https://github.com/rajan-g/angular2-google-place-autocomplete) repo. Please file issues and pull requests against that repo.

Live Demo

Live Demo Site OR Live Demo Site ##Usage node install npm install angular2-google-map-auto-complete bower install bower install google-map-auto-complete ###1.In index.html page include following script <script src="https://maps.googleapis.com/maps/api/js?libraries=places&sensor=false"></script> ###2.component file use like below import {Component} from 'angular2/core'; import {GoogleplaceDirective} from '../directives/googleplace.directive';

   @Component({
       selector : 'my-app',
       directives: [GoogleplaceDirective],
       template:  `
           <input type="text" [(ngModel)] = "address"  (setAddress) = "getAddress($event)" googleplace/>
           `    
   })
   export class AppComponent {
       public address : Object;
       getAddress(place:Object) {       
           this.address = place['formatted_address'];
           var location = place['geometry']['location'];
           var lat =  location.lat();
           var lng = location.lng();
           console.log("Address Object", place);
       }
   }

About

Angular2 goole place auto complete is a directive.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 46.2%
  • JavaScript 34.9%
  • HTML 18.9%