-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
26 lines (22 loc) · 741 Bytes
/
app.js
File metadata and controls
26 lines (22 loc) · 741 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
26
var app = angular.module("myApp" , []);
app.controller("myController" , function($scope , $http , $location){
$scope.getRandomQuote = function(){
console.log("sending request")
$scope.formattedData = "Fetching quote..."
var url = "https://andruxnet-random-famous-quotes.p.mashape.com/";
var h = {
"X-Mashape-Key": "37PnZ4VtcpmshHnSbvgGCWDjNjq3p1LpWc5jsn4G4MCAVy85GC",
"Content-Type": "application/x-www-form-urlencoded",
"Accept": "application/json"
};
var req = {
method: "POST",
url: "https://andruxnet-random-famous-quotes.p.mashape.com/?cat=movies",
headers: h
};
$http(req)
.then(function(response){
$scope.formattedData = response.data.quote + " - " + response.data.author;
});
};
});