0.1.6 • Published 4 years ago

ondevio-address v0.1.6

Weekly downloads
68
License
-
Repository
-
Last release
4 years ago

OndevioAddress

This project was generated with 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)

"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

import { OndevioAddressModule } from 'ondevio-address';

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

Import Service to app.component.ts

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
0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.2

4 years ago

0.1.3

4 years ago

0.1.0

4 years ago

0.1.1

4 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.1

5 years ago

0.0.0

5 years ago