
Security News
Another Round of TEA Protocol Spam Floods npm, But It’s Not a Worm
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.
org.webjars.bower:github-com-vskosp-vsGoogleAutocomplete
Advanced tools
Angularjs autocomplete module using Google Maps JavaScript API v3 and embedded autocomplete validator
bower install vs-google-autocomplete
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?libraries=places"></script>
Add vs-google-autocomplete.js to your index.html
Add vsGoogleAutocomplete module dependency:
angular.module('yourApp', ['vsGoogleAutocomplete']);
vs-google-autocomplete directive to input field:<form>
<input vs-google-autocomplete
ng-model="address"
name="address"
type="text">
</form>
You can add an options object as attribute parameter, which will restrict autocomplete results.
Options object can contain the following properties:
{Array.<string>} (In general only a single type is allowed):
{google.maps.LatLngBounds}{object}Example:
<form>
<input vs-google-autocomplete="options"
ng-model="address"
name="address"
type="text">
</form>
$scope.options = {
types: ['(cities)'],
componentRestrictions: { country: 'FR' }
}
In example above, autocomplete results will only consist of cities of France.
You can bind your model with autocomplete address components.
Directives for parsing:
vs-place - gets place detail results objectvs-place-id - gets unique identifier denoting placevs-street-number - gets street number of placevs-street - gets street name of placevs-city - gets city name of placevs-state - gets state name of placevs-country-short - gets country iso code of placevs-country - gets country name of placevs-latitude - gets latitude of placevs-longitude - gets longitude of placevs-post-code - gets postcode of placevs-district - gets district of place (administrative_area_level_2)Example:
<form>
<input vs-google-autocomplete="options"
ng-model="address.name"
vs-place="address.place"
vs-place-id="address.components.placeId"
vs-street-number="address.components.streetNumber"
vs-street="address.components.street"
vs-city="address.components.city"
vs-state="address.components.state"
vs-country-short="address.components.countryCode"
vs-country="address.components.country"
vs-district = "address.components.district"
name="address"
type="text">
</form>
Module, as an addition, also provides special validator for autocomplete validation.
Add vs-autocomplete-validator.js to your index.html
Add vs-autocomplete-validator directive to input field:
<form>
<input vs-google-autocomplete
vs-autocomplete-validator
ng-model="address"
name="address"
type="text">
</form>
By default, validator checks if autocomplete result is a valid google address (selected from drop down list).
You can add additional validator by adding denormalized validator name as attribute parameter. If you need more than one additional validator, you can add validator names using comma(,) separator.
Validator names in html are normalized in javascript code, so validator with name vsStreetAddress should have name vs-street-address in html.
Available validator names
vsStreetAddress - normalized name of validator, which checks if autocomplete result is full address (street number, street, ...)This module is under development and now it has only one additional validator (and one by default). Please, if you need other additional validators, you can write about this in issues, we will be grateful to you :).
Example
<form>
<input vs-google-autocomplete
vs-autocomplete-validator="vs-street-address"
ng-model="address"
name="address"
type="text">
</form>
In the example above validator will checks if autocomplete result is a valid google address and if it is a full address (street number, street, ...).
Validator publishes validation errors if validation is failed.
If validation is failed, validator publish error with name vsAutocompleteValidator to NgModelController.$error hash object and name of each embedded validator to NgModelController.vsAutocompleteErorr hash object.
You can also add your own validator for your own needs. Embedded validator should validate PlaceResult object, which returns after autocomplete. For this, you should add factory to your main module, which must return function.
Custom validator template:
angular.module('yourApp')
.factory('validatorName', function() {
/**
* Implementation of custom embedded validator.
* @param {google.maps.places.PlaceResult} PlaceResult object.
* @return {boolean} Valid status (true or false)
*/
function validate(place) {
// ...
}
return validate;
});
Rules for custom validator:
After adding custom validator, you should add its name as attribute parameter to vs-autocomplete-validator directive. Validator with name someValidatorName in factory should have name some-validator-name in html.
Core developers can inject in validator factory vsGooglePlaceUtilityservice, which contains useful functionality for working with PlaceResult object (parameter of function for validation). You can look at this utility service in vs-autocomplete-validator.js :).
K.Polishchuk (http://github.com/vskosp)
MIT © K.Polishchuk
Google Maps JavaScript API https://developers.google.com/maps/documentation/javascript/places-autocomplete
FAQs
WebJar for vsGoogleAutocomplete
We found that org.webjars.bower:github-com-vskosp-vsGoogleAutocomplete demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.