Hello together,
I want to make use of the angularUi integration Typeaehad. Here is the reference im refering to: Angular directives for Bootstrap
And here is the working Plnkr: Plunker - http://angular-ui.github.io/bootstrap/
That the code is working in Camunda I changed it a little bit:
<div ng-controller="TypeaheadCtrl">
<h4>Asynchronous results</h4>
<pre>Model: {{asyncSelected | json}}</pre>
<input type="text" ng-model="asyncSelected" placeholder="Locations loaded via $http" typeahead="address for address in getLocation($viewValue)" typeahead-loading="loadingLocations" typeahead-no-results="noResults" class="form-control">
<i ng-show="loadingLocations" class="glyphicon glyphicon-refresh"></i>
<div ng-show="noResults">
<i class="glyphicon glyphicon-remove"></i>No Results Found
</div>
</div>
<script>
function TypeaheadCtrl($scope, $http) {
$scope.selected = undefined;
$scope.getLocation = function (val) {
return $http.get('//maps.googleapis.com/maps/api/geocode/json', {
params: {
address: val,
sensor: false
}
}).then(function (response) {
return response.data.results.map(function (item) {
return item.formatted_address;
});
});
};
}
</script>
I tink the code is working however I always get this error:
Request Timeout : Your request timed out. Try to refresh the page.
Is there some magic I have to add to the code so it is able to get the location from Google API?
Cheers
Marc