-
Notifications
You must be signed in to change notification settings - Fork 9
/
index.html
54 lines (43 loc) · 1.24 KB
/
index.html
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
47
48
49
50
51
52
53
54
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Angular API Mock test page</title>
</head>
<body ng-app="testApp">
<div ng-controller="MainCtrl">
<p>
Name: {{name}}
</p>
<h2>Debug info</h2>
<p>
$location.protocol() = {{$location.protocol()}}<br>
$location.host() = {{$location.host()}}<br>
$location.port() = {{$location.port()}}<br>
$location.path() = {{$location.path()}}<br>
$location.search() = {{$location.search()}}<br>
$location.hash() = {{$location.hash()}}<br>
</p>
</div>
<script src="bower_components/angular/angular.js"></script>
<script src="scripts/angular-apimock.js"></script>
<script>
var app = angular.module('testApp', ['apiMock']);
app.config(function (apiMockProvider) {
apiMockProvider.config({
mockDataPath: '/mock_data',
apiPath: '/api'
});
});
app.controller('MainCtrl', function ($scope, $http, $location) {
$scope.name = '';
$scope.$location = $location;
$http.get('/api/people/pikachu').success(function(data) {
$scope.name = data.name;
}).error(function(data) {
$scope.name = 'No connection :( Now add ?apimock=true to the browser addressbar and try again ;)';
});
});
</script>
</body>
</html>