javascript或者angularJS如何使用Restful API获取后台接口的数据?

请问javascript或者angularJS如何使用Restful API获取后台接口的数据,语法如何写?

//页面
< script type="application/javascript" src="../js/xxx.js">
< table class="table table-striped">
< thead>
< tr>
< th>用户名
< th>密码
< /tr>
< /thead>
< tbody >
< tr ng-repeat="user in users">
< td>{{ user.username }}
< td>{{ user.loginpass }}

< /tbody>
< /table >

//js中:
angular
.module('myApp', [])
.controller(
'userCtrl',
function($scope, $http, $window) {
// 列表绑定
$http({
method : 'GET',
url : '/xxx/xxx',
params : {
'username' : 'xxx'
}
}).then(function successCallback(response) {
$scope.users = response.data;
}, function errorCallback(data) {
alert(data);
});
});

Rest风格不是已路径的方式获取数据吗