@mantec/ngx-address-finder
v1.0.4
Published
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.0.1.
Downloads
4
Readme
NgxAddressFinder
This library was generated with Angular CLI version 11.0.1.
Angular adapter for Address Finder
Import Module
In your Angular application, add the following code to app.module.ts
imports: [
...,
NgxAddressFinderModule.forRoot({
API_COUNTRY: "AU",
API_KEY: "YOUR_KEY_HERE"
})
...
],
Directive Usage
In MyForm.component.html
<input ngxAddressFinder
[(ngModel)]="addressString"
(ngModelChange)="myFunction1()"
(addressChange)="myFunction2($event)">
In MyForm.component.ts
....
public addressString: string = "";
...
myFunction1() {
console.log(this.addressString)
}
myFunction2(evt: addressInterface) {
console.log(evt)
}
Component Usage
In MyForm.component.html
<ngx-address-finder mode="material"
[(ngModel)]="addressObject"
(ngModelChange)="yourFunction()"></ngx-address-finder>
|Attribute |Available Value|
| ------------- |:-------------:|
| mode| material
bootstrap
|
Two-way Binding
Use [(ngModel)]
+ (ngModelChange)
as normal input field.
Address Interface
export interface AddressInterface{
addressLine1?: string,
addressLine2?: string,
suburb?: string,
state?: string,
postcode?: string,
metaData?: any,
fullAddress?: string
}
Code scaffolding
Run ng generate component component-name --project ngx-address-finder
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module --project ngx-address-finder
.
Note: Don't forget to add
--project ngx-address-finder
or else it will be added to the default project in yourangular.json
file.
Build
Run ng build ngx-address-finder
to build the project. The build artifacts will be stored in the dist/
directory.
Publishing
After building your library with ng build ngx-address-finder
, go to the dist folder cd dist/ngx-address-finder
and run npm publish
.
Running unit tests
Run ng test ngx-address-finder
to execute the unit tests via Karma.
Further help
To get more help on the Angular CLI use ng help
or go check out the Angular CLI Overview and Command Reference page.