Angularアプリでサーバーからモデル データを表示するベスト プラクティスは何ですか?
たとえば、私のコントローラーでは、(カスタムngResource
サービスを使用して) サーバーからモデルを取得しています。次に、アプリのクライアント側で何らかの異なるモデルを作成する必要があります。
customApiService.query({ url: 'items' }, function (res) {
// made it like this and do everything in partials with "ng-repeat"?!
$scope.items = res;
// but i need to model server data on client...
angular.forEach(res, function (key, i) {
$scope.viewModel = {
description: key.anotherNameField // e.g. different third-party services return description under different names
};
});
});