- Google map API
- AngularJs
It is really simple
- Include the geo_library_service.js in a script tag source and
- In your angular module put a dependency for geoAutoComplete.
angular.module('myApp', ['geoAutoComplete'])
This library provides you few directive for getting city, state, and current locality. The directives are: * geoCity * geoState * geoNeighbourhood
They can be used like:
<geo_city css-class='city-box' country-city-map='countryCityMap'> </geo_city>
<geo_state css-class='city-box' country-state-map='countryStateMap'> </geo_state>
<geo_neighbourhood css-class='city-box'></geo_neighbourhood>
Note:
Here we have the option to define our city and state list. In the above html, 'country-city-map' and 'country-state-map' expects an object containing country with cities and country with states respectively.
ex:
$scope.countryCityMap = {
'india': ['Chennai', 'Bangalore', 'Mumbai', 'New Delhi', 'Patna']
};
$scope.countryStateMap = {
'india': ['Karnataka', 'Bihar', 'Maharashtra', 'Punjab']
};
According to this list, the select option will come. One more thing we have the option to stick our own css too.