ngx-address-data-gouv-search

Web Component with an input field with autocompletion that allows user to search real french addresses using official web service : https://adresse.data.gouv.fr/api-doc

View on GitHub

NgxAddressDataGouv

The aim of this project is to provide a web custom elements with an autocomplete input that consume the API of https://adresse.data.gouv.fr/api-doc
With this component you can fill an french address that will be validated against official https://adresse.data.gouv.fr/api-doc

You may also import the StandaloneModule to use the component inside your angular project.

Installation

`npm install @rebolon/ngx-address-data-gouv-search`

Demo



    

Usage

Html or any web applications

This is the web-components usage: you only need to require the javascript files in your html template like this:

          
            <script src="node_modules/ngx-address-data-gouv-search/dist/app/output.js" type="module"></script>
          
        

Angular application

This is the library usage: Import the library from dist in your module or your component like this

          
            import {AddressSearchComponent} from '@rebolon/ngx-address-data-gouv-search/dist/lib/';
            ...
            @NgModule OR @Component({
              imports: [
                ...
                AddressSearchComponent,
              ],
            ...
          
        

Usage of the component

And then you can use the custom elements everywhere like this:

          
            <ngx-address-data-gouv-search></ngx-address-data-gouv-search>
          
        

Parameters

Output

Sample

          
            <ngx-address-data-gouv-search (addressFound)="console.log($event)" label="Just fill the input with a french postal address: " width="500"></ngx-address-data-gouv-search>
          
        

Extra infos

In fact you should never keep node_modules in production, but you should move dist files in your app using Webpack, or your Continous Integration with your pipelines.

This project was generated with Angular CLI version 8.0.6.

Development server

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

This is the debug mode, a bit like a StoryBook project where the component AddressSearchComponent is built like a full angular component

Build

Run npm run build to build the project as a custom element.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

Run ng e2e to execute the end-to-end tests via Protractor.

Further help

You can add issues or do some PR to improve this package !