You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README-ja-jp.md
+16-16Lines changed: 16 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,7 @@ _このドキュメントは[AngularJS in Patterns](https://github.com/mgechev/a
36
36
*[ページ・コントローラ](#ページ・コントローラ)
37
37
*[その他](#その他)
38
38
*[モジュール・パターン](#モジュール・パターン)
39
-
*[Data Mapper](#data-mapper)
39
+
*[データ・マッパ](#データ・マッパ)
40
40
*[References](#references)
41
41
42
42
<!--endtoc-->
@@ -1014,28 +1014,28 @@ app.factory('foo', function () {
1014
1014
1015
1015
Once we want to inject `foo` inside any other component we won't be able to use the private methods, but only the public ones. This solution is extremely powerful especially when one is building a reusable library.
1016
1016
1017
-
### Data Mapper
1017
+
### データ・マッパ
1018
1018
1019
-
>A Data Mapper is a Data Access Layer that performs bidirectional transfer of data between a persistent data store (often a relational database) and an in memory data representation (the domain layer). The goal of the pattern is to keep the in memory representation and the persistent data store independent of each other and the data mapper itself.
As the description above states, the data mapper is used for bidirectional transfer of data between a persistent data store and an in memory data representation. Usually our AngularJS application communicates with API server, which is written in any server-side language (Ruby, PHP, Java, JavaScript, etc.).
Usually, if we have RESTful API`$resource`will help us communicate with the server in Active Record like fashion. Although, in some applications the data entities returned by the server are not in the most appropriate format, which we want to use in the front-end.
For instance, lets assume we have application in which each user has:
1027
+
例えば、ユーザが次の要素を持つと想定してみてください:
1028
1028
1029
-
- name
1030
-
- address
1031
-
- list of friends
1029
+
- 名前
1030
+
- 住所
1031
+
- 友達リスト
1032
1032
1033
-
And our API has the methods:
1033
+
そして、APIが次のメソッドを持つとします:
1034
1034
1035
-
- `GET/user/:id` - returns the user's name and the address of given user
1036
-
- `GET/friends/:id` - returns the list of friends of given user
1035
+
- `GET/user/:id` - ユーザの名前と住所を返します
1036
+
- `GET/friends/:id` - ユーザの友達リストを返します
1037
1037
1038
-
Possible solution is to have two different services, one for the first method and one for the second one. Probably more useful solution would be if we have a single service called `User`, which loads the user's friends when we request the user:
0 commit comments