# ondevio-address

> This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.3.0.

Latest version **0.1.6** (published 2020-03-24) · 0 weekly downloads

## Install

```sh
npm install ondevio-address
pnpm add ondevio-address
yarn add ondevio-address
bun add ondevio-address
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.6 |
| Published | 2020-03-24 |
| First published | 2019-04-16 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 1 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | ondevio |

## Links

- npm: https://www.npmjs.com/package/ondevio-address
- npm.io page: https://npm.io/package/ondevio-address

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^1.9.0

## Recent versions

- 0.1.6 (latest) — 2020-03-24
- 0.1.5 — 2019-12-23
- 0.1.4 — 2019-12-23
- 0.1.3 — 2019-12-09
- 0.1.2 — 2019-12-09
- 0.1.1 — 2019-11-21
- 0.1.0 — 2019-11-21
- 0.0.13 — 2019-07-31
- 0.0.10 — 2019-07-22
- 0.0.9 — 2019-06-28
- 0.0.8 — 2019-06-11
- 0.0.7 — 2019-05-31
- 0.0.5 — 2019-05-20
- 0.0.4 — 2019-05-15
- 0.0.3 — 2019-05-15
- … 2 more at https://npm.io/package/ondevio-address/versions

## README

# OndevioAddress

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.3.0.

The library show address form.

## Development server

Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.

## How to use

Append dependencies in package.json file
(ondevio-translate: set language to table list)

```json
"dependencies": {
    ...
    "@ngx-translate/core": "^11.0.1",
    "@ngx-translate/http-loader": "^4.0.0",
    "ondevio-translate": "^1.0.4",
    "ondevio-address": "^0.0.1",
    ...
  },
```

Import module library to app.module.ts, import library and append to NgModules imports list
```typescript
import { OndevioAddressModule } from 'ondevio-address';

..
@NgModule({
    declarations: [        
       ...
    ],
    imports     : [
       ...
        OndevioAddressModule,
    ],
    bootstrap   : [
        AppComponent
    ]
})
```

Import Service to app.component.ts

```typescript
import { OndevioAddressService } from 'ondevio-address';
import { OndevioTranslateService } from 'ondevio-translate';
import { locale as es } from './i18n/es';
import { locale as en } from './i18n/en';

 constructor(
    ...
        private _ondevioTranslate: OndevioTranslateService,
        private _ondevioAddress: OndevioAddressService
    ) {
        ...
        //See ondevio-translate "How to use" instrunctions for serviceConfig params
        this._ondevioTranslate.setTranslateServiceConfig(serviceConfig);
        let addressServiceConfig = {
            locationUrl: 'http://localhost:8080/location/api',
            hasPlace: false,
            hasMap: false,
            retry: 3 // Optional value default value 0, Disabled retry opotions
            hasNumber: true, //Optional, default true. Shows Number address inputs
            required: {
                codigoTipoVia: true,
                calle: true,
                numero: true,
                escalera: false,
                piso: false,
                puerta: false,
                localidad: true,
                urbanizacion: true,
                codigoPostal: true,
                provinciaIne: true,
                codigoPoblacion: true
                }, // Optional  class RequiredConfig with required inputs configuration
        }
        this._ondevioAddress.setAddressServiceConfig(addressServiceConfig);
        ...
    }
```

## Service Params

* locationUrl: Url base for rest services.

There are some methods defined in Rest Service:

* getProvinciaPoblacion(codigoPostal):
* getProvincia(codigoProvincia):
* getProvincias():
* getCodigoPostal(poblacion):
* getPoblacionesByProvincia(codigoProvincia):
* getPoblacionesByProvinciaOrCodigoPostal(codigoProvincia, codigoPostal);

## Html Params

Append selector ```<ondevio-address [direccion]="address" (valueChange)="getAddressForm($event)"></ondevio-address>``` in your html component.

* direccion: Model to append address values
* valueChange: Return a addressForm: NgForm when some changes are detected

---
_Source: https://npm.io/package/ondevio-address · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
