forked from angularify/angularjs-json-rpc
-
Notifications
You must be signed in to change notification settings - Fork 3
/
test2.js
24 lines (20 loc) · 825 Bytes
/
test2.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//This example uses dependency injection, which is minification safe!
//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', ['$scope', '$http' , 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){
scope.team = data.result.team;
}else{
scope.team = ["Unable to retrieve team members"];
}
}).error(function(data, status, headers, config){
});
};
scope.refresh();
}]);