forked from sarunyou/ProjectSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontroller.js~
More file actions
25 lines (24 loc) · 852 Bytes
/
controller.js~
File metadata and controls
25 lines (24 loc) · 852 Bytes
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
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope, $http) {
$scope.firstName = "John";
$scope.lastName = "Doe";
$scope.message = "";
var webSerLink = "http://52.221.229.107:8080/search?q=";
$scope.search = function() {
$scope.loading = true;
var res = encodeURI($scope.message);
res = res.replace(/%0A/g, "%5Cn");
$http({
method: "GET",
url: webSerLink + res,
dataType: 'jsonp',
crossDomain: true
}).then(function mySucces(response) {
$scope.loading = false;
console.log("looking for " + $scope.message + " with " + webSerLink + res);
$scope.result = response.data;
}, function myError(response) {
$scope.result = response.statusText;
});
}
});