1

特定の顧客のすべてのドメインを取得するために、angular を使用して mongodb を反復処理する最良の方法を知りたいと思っています。

MongoDB からの私の JSON は次のとおりです。

    {
"_id": {
    "$oid": "513568dae4b08eabdba2eb63"
},
"name": "Sofa King",
"contactPrimaryName": "Richard Cranium",
"contactPrimaryPhone": "410 555-1212",
"contactPrimaryEmail": "me@mysite.com",
"PrimaryAddress": "123 Any Street\nApt. 17",
"contactPrimaryCity": "Nashville",
"contactPrimaryState": "TN",
"contactPrimaryZip": "22222",
"site": "http://www.mysite.com",  //ignore, replacing with domains
"domains": [
    {
        "url": "http://www.mysite.com",
        "ns1": "ns1.mydns.com",
        "ns2": "ns2.mydns.com",
        "registered": "2011-01-01",
        "expires": "2014-01-01"
    },
    {
        "url": "http://www.myother.com",
        "ns1": "ns1.mydns.com",
        "ns2": "ns2.mydns.com",
        "registered": "2012-02-02",
        "expires": "2015-02-02"
    }
]

次の方法で顧客の詳細を取得できることを知っています。

    <tr ng-repeat="customer in customers | filter:search | orderBy:'name'">
    <td><a href="{{customer.site}}" target="_blank">{{customer.name}}</a></td>
    <td>{{customer.contactPrimaryName}}</td>
    <td>{{customer.contactPrimaryPhone}}</td>
    <td>{{customer.contactPrimaryEmail}}</td>

しかし、特定の顧客のドメイン URL を取得する方法がわかりません。

私の目標は、その顧客のドメインを表示するためのボタンを備えた 1 つのページに顧客リストを作成することです。特定の顧客のドメインを表示すると、ドメインを追加できます。

4

1 に答える 1

4

現在の顧客の「ドメイン」配列を反復処理できるはずです。

<tr ng-repeat="customer in customers | filter:search | orderBy:'name'">
...
    <td>
        <div data-ng-repeat="domain in customer.domains">
            // Do stuff in here with the domain for that customer
        </div>
    </td>
</tr>
于 2013-03-06T14:58:41.060 に答える