-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflight.js
More file actions
executable file
·46 lines (43 loc) · 1.42 KB
/
flight.js
File metadata and controls
executable file
·46 lines (43 loc) · 1.42 KB
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
42
43
44
45
46
var app = angular.module('flightApp', [], function($locationProvider) {
$locationProvider.html5Mode({
enabled: true
});
});
app.controller('flightController', function($scope, $http, $location) {
var from = $location.search()['from']
var to = $location.search()['to']
var startdates = $scope.start = $location.search()['start']
var enddates = $scope.end = $location.search()['end']
$http.get('api/tos/'+to+'/froms/'+from+'/startdates/'+startdates+'/enddates/'+enddates+'.json').
success(function(data, status, headers, config) {
$scope.flights = data;
}).
error(function(data, status, headers, config) {
// log error
});
$http.get('api/citynames/'+from+'.json').
success(function(data, status, headers, config) {
$scope.from = data;
}).
error(function(data, status, headers, config) {
// log error
});
$http.get('api/citynames/'+to+'.json').
success(function(data, status, headers, config) {
$scope.to = data;
$scope.toImage = './images/destination/'+data+'.jpg';
}).
error(function(data, status, headers, config) {
// log error
});
});
app.directive('backImg', function(){
return function(scope, element, attrs){
attrs.$observe('backImg', function(value) {
element.css({
'background-image': 'url(' + value +')',
'background-size' : 'cover'
});
});
};
});