2

RO Isisサーバーでいくつかの安らかなサービスを消費するAngularJSでクライアントWebアプリケーションを作成しています。私はSpiro Angularクライアントの使用を検討していましたが、その過程でRestangularサービスに出会いました.純粋なAngularJSまたはRestangularを使用する方が良いかどうかについてのガイダンスが必要です. 実際のエンタープライズ アプリケーションで EITHER を使用する場合の長所と短所。

注: 私の概念実証は、RO サーバーからリストを作成、更新、削除、取得することです。getList で次の作業を行いましたが、完全な CRUD を実行する必要があります

sampleApp.controller('XXXController', function($scope, $http) {

    //Outer Restful call
    $http({ method:'GET',
        url: 'http://localhost:8080/XXX-webapp-1.0-SNAPSHOT/restful/services/XXXXX/actions/listAll/invoke',
        headers: {'Accept': 'application/json'}
}).
        success(
        function (data) {
          var resultType = data.resulttype;
          var objects = data.result.value;
          $scope.rowList= [];
          console.log(objects);

          if(resultType == "list"){
            for(i=0; i < objects.length; i++){
              //Inner Restful call
              $http({ method:'GET',url: objects[i].href,headers: {'Accept': 'application/json'}
              }).
                success(
                function (rowdata) {
                  $scope.rowList.push(rowdata);
                }
              );
            }
          }
        }
      );
    });
4

2 に答える 2

1

github read.me はかなり簡単です...

https://github.com/mgonto/restangular#starter-guide

使いやすさのために、ngResource よりも Restangular を好みます。

于 2014-04-08T04:22:29.120 に答える
0

RestFul アプリケーションを開発している場合は、angular を使用することをお勧めしますngResource

http://docs.angularjs.org/api/ngResource/service/$resource
于 2014-03-03T12:57:29.820 に答える