-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
46 lines (38 loc) · 1.09 KB
/
script.js
File metadata and controls
46 lines (38 loc) · 1.09 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("computer",['ngRoute'])
.config(['$routeProvider', function($routeProvider){
$routeProvider.
when('/main',{
templateUrl: 'main.html',
controller: 'MainCtrl'
}).
when('/about',{
templateUrl: 'about.html',
controller: 'MainCtrl'
}).
when('/services',{
templateUrl: 'services.html',
controller: 'ServicesCtrl'
}).
when('/contact',{
templateUrl: 'contact.html',
controller: 'ContactCtrl'
}).
otherwise({redirectTo:'/main'});
}])
.controller('MainCtrl',['$scope', '$http', function($scope, $http){
$scope.person = 'John Doe';
console.log($scope);
$http.get('services.json').then(function(response){
$scope.services = response.data;
});
}])
.controller('ServicesCtrl',['$scope', '$http', function($scope, $http){
$http.get('services.json').then(function(response){
$scope.services = response.data;
});
}])
.controller('ContactCtrl',['$scope','$http', function($scope, $http){
$http.get('locations.json').then(function(response){
$scope.locations = response.data;
});
}]);