-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathui.js
More file actions
51 lines (42 loc) · 1.31 KB
/
ui.js
File metadata and controls
51 lines (42 loc) · 1.31 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
47
48
49
50
51
/* global angular */
var demoApp = angular.module('demoApp', ['jsf']);
demoApp.controller('demoCtrl', function ($scope, $http) {
function displayJSON(response) {
$scope.result = JSON.stringify(response.data, null, 4);
}
function displaySchema(schema) {
return function(){
$scope.schema = JSON.stringify(schema, null, 4);
}
}
$scope.getUsersCollectionClick = function () {
$http({
method: "GET",
url: '/users'
}).then(displayJSON).then(displaySchema(schemas.UserCollectionGet));
};
$scope.getUserItemClick = function () {
$http({
method: "GET",
url: '/users/123'
}).then(displayJSON).then(displaySchema(schemas.UserItemGet));
};
$scope.postUserItemClick = function () {
$http({
method: "POST",
url: '/users/71'
}).then(displayJSON).then(displaySchema(''));
};
$scope.putUserItemClick = function () {
$http({
method: "PUT",
url: '/users'
}).then(displayJSON).then(displaySchema(schemas.UserItemCreate));
};
$scope.deleteUserItemClick = function () {
$http({
method: "DELETE",
url: '/users/617'
}).then(displayJSON).then(displaySchema(''));
};
});