@angular-magic/ngx-gp-autocomplete
Advanced tools
Comparing version 1.0.4 to 2.0.0
/// <reference types="google.maps" /> | ||
import { AfterViewInit, ElementRef, EventEmitter, NgZone } from '@angular/core'; | ||
import { NgxGpConfig } from "./ngx-gp-config"; | ||
import { NgxGpAutocompleteOptions } from "./ngx-gp-autocomplete-options"; | ||
import { NgxGpAutocompleteService } from "./ngx-gp-autocomplete.service"; | ||
import { Loader } from '@googlemaps/js-api-loader'; | ||
import { NgxGpAutocompleteOptions } from './ngx-gp-autocomplete-options'; | ||
import { NgxGpAutocompleteService } from './ngx-gp-autocomplete.service'; | ||
import * as i0 from "@angular/core"; | ||
@@ -10,3 +10,3 @@ export declare class NgxGpAutocompleteDirective implements AfterViewInit { | ||
private ngxGpAutocompleteService; | ||
private config; | ||
private loader; | ||
private ngZone; | ||
@@ -18,3 +18,3 @@ options: NgxGpAutocompleteOptions; | ||
private autocomplete; | ||
constructor(el: ElementRef, ngxGpAutocompleteService: NgxGpAutocompleteService, config: NgxGpConfig, ngZone: NgZone); | ||
constructor(el: ElementRef, ngxGpAutocompleteService: NgxGpAutocompleteService, loader: Loader, ngZone: NgZone); | ||
ngAfterViewInit(): void; | ||
@@ -26,3 +26,3 @@ private isGoogleLibExists; | ||
static ɵfac: i0.ɵɵFactoryDeclaration<NgxGpAutocompleteDirective, never>; | ||
static ɵdir: i0.ɵɵDirectiveDeclaration<NgxGpAutocompleteDirective, "[ngx-gp-autocomplete]", ["ngx-places"], { "options": "options"; }, { "onAddressChange": "onAddressChange"; }, never, never, false, never>; | ||
static ɵdir: i0.ɵɵDirectiveDeclaration<NgxGpAutocompleteDirective, "[ngx-gp-autocomplete]", ["ngx-places"], { "options": { "alias": "options"; "required": false; }; }, { "onAddressChange": "onAddressChange"; }, never, never, false, never>; | ||
} |
@@ -1,7 +0,4 @@ | ||
import { ModuleWithProviders } from '@angular/core'; | ||
import { NgxGpConfig } from "./ngx-gp-config"; | ||
import * as i0 from "@angular/core"; | ||
import * as i1 from "./ngx-gp-autocomplete.directive"; | ||
export declare class NgxGpAutocompleteModule { | ||
static forRoot(config: NgxGpConfig): ModuleWithProviders<NgxGpAutocompleteModule>; | ||
static ɵfac: i0.ɵɵFactoryDeclaration<NgxGpAutocompleteModule, never>; | ||
@@ -8,0 +5,0 @@ static ɵmod: i0.ɵɵNgModuleDeclaration<NgxGpAutocompleteModule, [typeof i1.NgxGpAutocompleteDirective], never, [typeof i1.NgxGpAutocompleteDirective]>; |
@@ -1,2 +0,2 @@ | ||
import { NgxGpAutocompleteOptions } from "./ngx-gp-autocomplete-options"; | ||
import { NgxGpAutocompleteOptions } from './ngx-gp-autocomplete-options'; | ||
import * as i0 from "@angular/core"; | ||
@@ -3,0 +3,0 @@ export declare class NgxGpAutocompleteService { |
{ | ||
"name": "@angular-magic/ngx-gp-autocomplete", | ||
"version": "1.0.4", | ||
"version": "2.0.0", | ||
"description": "This module is a wrapper for Google Places Autocomplete JS library", | ||
@@ -22,2 +22,3 @@ "author": "Dan Cornilov", | ||
"google places", | ||
"angular 16", | ||
"angular 15", | ||
@@ -44,7 +45,3 @@ "angular 14", | ||
"sideEffects": false, | ||
"module": "fesm2015/angular-magic-ngx-gp-autocomplete.mjs", | ||
"es2020": "fesm2020/angular-magic-ngx-gp-autocomplete.mjs", | ||
"esm2020": "esm2020/angular-magic-ngx-gp-autocomplete.mjs", | ||
"fesm2020": "fesm2020/angular-magic-ngx-gp-autocomplete.mjs", | ||
"fesm2015": "fesm2015/angular-magic-ngx-gp-autocomplete.mjs", | ||
"module": "fesm2022/angular-magic-ngx-gp-autocomplete.mjs", | ||
"typings": "index.d.ts", | ||
@@ -57,9 +54,7 @@ "exports": { | ||
"types": "./index.d.ts", | ||
"esm2020": "./esm2020/angular-magic-ngx-gp-autocomplete.mjs", | ||
"es2020": "./fesm2020/angular-magic-ngx-gp-autocomplete.mjs", | ||
"es2015": "./fesm2015/angular-magic-ngx-gp-autocomplete.mjs", | ||
"node": "./fesm2015/angular-magic-ngx-gp-autocomplete.mjs", | ||
"default": "./fesm2020/angular-magic-ngx-gp-autocomplete.mjs" | ||
"esm2022": "./esm2022/angular-magic-ngx-gp-autocomplete.mjs", | ||
"esm": "./esm2022/angular-magic-ngx-gp-autocomplete.mjs", | ||
"default": "./fesm2022/angular-magic-ngx-gp-autocomplete.mjs" | ||
} | ||
} | ||
} |
@@ -5,2 +5,1 @@ export * from './lib/ngx-gp-autocomplete.module'; | ||
export * from './lib/ngx-gp-autocomplete-options'; | ||
export * from './lib/ngx-gp-config'; |
# ngx-gp-autocomplete | ||
<p align="center"> | ||
@@ -6,3 +7,3 @@ <img alt="Ngx-Markdown Logo" src="https://ngx-validator.angularmagic.com/assets/cover.png"> | ||
**Demo: https://ngx-gp-autocomplete.angularmagic.com** | ||
**Demo: <https://ngx-gp-autocomplete.angularmagic.com>** | ||
@@ -15,19 +16,21 @@ This module is a wrapper for Google Places Autocomplete js library. Initial code base was copied from this project | ||
# Installation | ||
#### npm | ||
``` | ||
## Installation | ||
### npm | ||
```sh | ||
npm install @angular-magic/ngx-gp-autocomplete | ||
``` | ||
``` | ||
```sh | ||
npm install @googlemaps/js-api-loader | ||
``` | ||
``` | ||
```sh | ||
npm install --save @types/google.maps | ||
``` | ||
### Integration | ||
# Integration | ||
1. Import NgxGpAutocompleteModule into your application module | ||
- Import NgxGpAutocompleteModule into your application module | ||
@@ -39,30 +42,42 @@ ```ts | ||
imports: [ | ||
NgxGpAutocompleteModule.forRoot({ | ||
loaderOptions: { | ||
apiKey: 'YOUR_API_KEY', | ||
libraries: ['places'] | ||
} | ||
}), | ||
NgxGpAutocompleteModule, | ||
BrowserModule, | ||
FormsModule, | ||
...], | ||
.... | ||
//... | ||
], | ||
providers: [ | ||
{ | ||
provide: Loader, | ||
useValue: new Loader({ | ||
apiKey: 'AIzaSyAFaylOBsuhYPYw9YqWmhN370xTvc6DXYU', | ||
libraries: ['places'] | ||
}) | ||
}, | ||
//... | ||
], | ||
//... | ||
}) | ||
``` | ||
2. Replace YOUR_API_KEY with google places api key. Ref - https://developers.google.com/places/web-service/get-api-key | ||
- Replace YOUR_API_KEY with google places api key. Ref - <https://developers.google.com/places/web-service/get-api-key> | ||
2. Add directive ngx-gp-autocomplete to your input field (options is an optional parameter) | ||
``` | ||
- Add directive ngx-gp-autocomplete to your input field (options is an optional parameter) | ||
```html | ||
<input #placesRef="ngx-places" ngx-gp-autocomplete [options]='options' (onAddressChange)="handleAddressChange($event)"/> | ||
``` | ||
3. Additionally you can reference directive in your component | ||
- Additionally you can reference directive in your component | ||
```ts | ||
@ViewChild("placesRef") placesRef : NgxGpAutocompleteDirective; | ||
public handleAddressChange(place: google.maps.places.PlaceResult) { | ||
// Do some stuff | ||
} | ||
export class Component { | ||
@ViewChild('ngxPlaces') placesRef: NgxGpAutocompleteDirective; | ||
public handleAddressChange(place: google.maps.places.PlaceResult) { | ||
// Do some stuff | ||
} | ||
} | ||
``` | ||
# GitHub | ||
Please feel free to declare issues or contribute: https://github.com/angular-magic/ngx-gp-autocomplete | ||
## GitHub | ||
Please feel free to declare issues or contribute: <https://github.com/angular-magic/ngx-gp-autocomplete> |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
81
41494
16
323
1