forked from angularify/angularjs-json-rpc
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest.js
More file actions
23 lines (20 loc) · 786 Bytes
/
test.js
File metadata and controls
23 lines (20 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//All you need to do to declare the dependency on the angular-json-rpc module is add it to the array when you create a module.
angular.module('test-module-jsonrpc', ['angular-json-rpc'])
.controller('TestController', function ($scope, $http) {
$scope.name = "cfairweather";
$scope.team = [];
$scope.refresh = function(){
//url, method, parameters, config
$http.jsonrpc('url/to/jsonrpc/service', 'methodToCall', [param1, param2, etc])
.success(function(data, status, headers, config){
if(data.result.team){
//If service returns team as an array
$scope.team = data.result.team;
}else{
$scope.team = ["Unable to retrieve team members"];
}
}).error(function(data, status, headers, config){
});
};
$scope.refresh();
});