Skip to content

Instantly share code, notes, and snippets.

@kris
Created August 4, 2014 22:26
// Restaurants finder
ink.controller('FinderRestaurantCtrl', ['$scope', 'Restaurant', 'Geocoder', function($scope, Restaurant, Geocoder) {
// Businesses
$scope.businesses = [];
// Filters
$scope.filters = {};
// Search
$scope.lookup = function() {
Restaurant.query(function(businesses) {
$scope.businesses = businesses;
});
}
// Lookup address
$scope.geocode = function() {
var promise = Geocoder.geocodeAddress($scope.filters.location);
promise.then(
function (result) {
$scope.filters.lat = result.lat;
$scope.filters.lng = result.lng;
},
function (error) {
console.log(error.message);
}
);
}
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment