-
Notifications
You must be signed in to change notification settings - Fork 8
/
SearchCtrl.js
41 lines (38 loc) · 1.02 KB
/
SearchCtrl.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"use strict";
/**
* Controller to perform search in sn.example.
* @class SearchCtrl
* @module sn.example
* @author SOON_
*/
angular.module("sn.example").controller("SearchCtrl", [
"$scope",
"$rootScope",
"$http",
"$location",
/**
* @constructor
* @param {Object} $scope
* @param {Service} $rootScope
* @param {Service} $http
* @param {Service} $location
*/
function ($scope, $rootScope, $http, $location) {
/**
* Search locations based on val
* @method getLocation
* @param {String} val location to query
*/
$scope.getLocation = function getLocation(val){
$http.get("http://maps.googleapis.com/maps/api/geocode/json", {
params: {
address: val,
sensor: false
}
}).then(function (response){
$rootScope.results = response.data.results;
$location.path("/results");
});
};
}
]);