<div class="form-group"> <label for="videoLocationInput">Location</label>
<p class="input-group"> <input type="text" autocomplete="on" ng-model="location" placeholder="Location" uib-typeahead-append-to-body="true" uib-typeahead-on-select="setLocation($item, $model, $label)" name="locationInput" uib-typeahead-loading="loadingLocations" uib-typeahead-no-results="noResults" class="form-control"> <span class="input-group-addon"> <i ng-show="loadingLocations" class="fa fa-spinner fa-spin"></i> <i ng-show="noResults" class="fa fa-ban"></i> <i ng-show="!(noResults || loadingLocations)" class="fa fa-check"></i> </span> </p> </div>$scope.location = null; $scope.loadingLocations = false; $scope.noResults = true; $scope.getLocation = function (val) { return mapi.location.autocomplete(val).then(function (response) { if (!response.autocomplete) return null; return response.autocomplete.filter(function (item) { switch (item.area_type) { case 'city': item.name = item.city + ', ' + item.state_code; break;
case 'neighborhood': item.name = item.neighborhood + ", " + item.city + ', ' + item.state_code; break;
case 'state': item.name = item.state_code; break;
default: return false; } return item; }); }); }; $scope.setLocation = function ($item, $model, $label) { $scope.video.location_name = $label; $scope.video.location = { lat: _.get($item, 'centroid.lat', undefined), lon: _.get($item, 'centroid.lon', undefined) }; refreshMatchingPlaylists(); };Enter code here...