ondevio-address v0.1.6
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
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago