Giter Site home page Giter Site logo

edymerchk / ember-place-autocomplete Goto Github PK

View Code? Open in Web Editor NEW

This project forked from esbanarango/ember-place-autocomplete

0.0 0.0 0.0 110 KB

Ember cli addon to provide a component that uses Google Places API to autocomplete place information when people write their address

License: MIT License

JavaScript 70.60% CSS 7.35% HTML 22.05%

ember-place-autocomplete's Introduction

Ember Place Autocomplete

Description

Ember cli addon to provide a component that uses Google Places API to autocomplete place information when someone writes an address in a text field.

Usage

In order to use this addon you just have to use the component in your templates.

{{place-autocomplete-field
  value= model.address
  label= "Model Address"
  errors= model.errors.address
  showErrors= true
  contr= this
  containerClass= 'place-autocomplete--container'
  labelClass= 'place-autocomplete--label'
  errorClass= 'place-autocomplete--error'
  inputClass= 'place-autocomplete--input'
  requiredDetails= requiredDetails
  showDetails=true
}}

```
### Options:

**option**       | **description**
---              | ---            |
value            | Model attribute where the address attribute is going to be stored.
label            | String: Label for the address attribute input.
errors           | Attribute validation errors to be able to display validation errors when needed.
showErrors       | Boolean: value to know if the attributes errors should be displayed.
contr            | Controller that is going to handle the **focusOutCallback** function that could be triggered from the component.
containerClass   | String : CSS class for the main component container.
labelClass       | String : CSS class for the label.
errorClass       | String : CSS class for errors.
inputClass       | String : CSS class for the attribute input.
requiredDetails  | Details that you want to display and which style is going to be used to display it.
requireLocation  | Boolean: to know if location details should be displayed
showDetails      | Boolean: to know if google Details described in **requiredDetails** should be displayed.
detailsDisable   | Boolean: to indicate if the details fields should be disabled or not.
focusOutCallback | String : Name of the function that is going to be executed after focus out in the address input

#### requiredDetails

you can defined a variable in you controller to tell the component which google Details you want to display and the style you want to use. Ex:
```js
 export default Ember.Controller.extend({
   requiredDetails: {
    street_number: 'short_name',
     route: 'long_name',
     locality: 'long_name',
     administrative_area_level_1: 'long_name',
     country: 'long_name',
     postal_code: 'short_name'
   }
 });
```
You have two styles:
* 'long_name'
* 'short_name'

#### requiredDetails

Location details are the Lat and Long of the place.

## Collaborating

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request

## Installation

* `git clone` this repository
* `npm install`
* `bower install`

## Running

* `ember server`
* Visit your app at http://localhost:4200.

## Running Tests

* `ember test`
* `ember test --server`

## Building

* `ember build`

For more information on using ember-cli, visit [http://www.ember-cli.com/](http://www.ember-cli.com/).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.