質問を得るにはopen eyes
0 values length
はangularjsで?私は、(i)のためのソリューションを持って私のplunkerで Angularjsで0の値の長さを取得するには?
- は質問のない合計(ⅱ)upvotesのないとの(III)を開き目総和を合計しない[値1]、私たち(iv)
Open Eyes
0値の取得方法は、length
です。 Open Eyes
[0の値が]length
、私は間違いをしたところ、私はこの
{{question.openeyes.length == '0'}
を使用した場合、私は知らない参照用my plunkerを見てください取得する方法私はFalse
を得た答えは、 期待の回答次のようになります。2
マイHTML: -
<p>Total no of questions :{{question.length}} </p>
<p>Total no of upvotes : {{resultValue | sumOfValue:'upvotes'}}</p>
<p>Total no of Open Eyes of [1 values] : {{resultValue | sumOfValue:'openeyes'}}</p>
<p class="color">Total no of Open Eyes of [0 value] : {{question.openeyes.length == '0'}}</p>
マイデータ: -
$scope.question = [
{
"_id": "5936a70095e3a85804aae050",
"user": {
"_id": "58072aba0f82a61823c434df",
"displayName": "Table 1",
"roles": ["admin"],
"profileImageURL": "./modules/users/client/img/ownprofile/uploads/1f08308f43b0674d61a2cc5d95deb5ef",
"email": "[email protected]",
"categories": []
},
"__v": 1,
"openeyers": ["[email protected]"],
"openeyes": 1,
"upvoters": ["[email protected]"],
"upvotes": 1,
"title": "what is cricket",
"created": "2017-06-06T12:58:40.204Z"
},
{
"_id": "5936a70095e3a85804aae050",
"user": {
"_id": "58072aba0f82a61823c434df",
"displayName": "Table 1",
"roles": ["admin"],
"profileImageURL": "./modules/users/client/img/ownprofile/uploads/1f08308f43b0674d61a2cc5d95deb5ef",
"email": "[email protected]",
"categories": []
},
"__v": 1,
"openeyers": [],
"openeyes": 0,
"upvoters": ["[email protected]"],
"upvotes": 1,
"title": "who fan you are",
"created": "2017-06-06T12:58:40.204Z"
},
{
"_id": "5936a70095e3a85804aae050",
"user": {
"_id": "58072aba0f82a61823c434df",
"displayName": "Table 1",
"roles": ["admin"],
"profileImageURL": "./modules/users/client/img/ownprofile/uploads/1f08308f43b0674d61a2cc5d95deb5ef",
"email": "[email protected]",
"categories": []
},
"__v": 1,
"openeyers": [],
"openeyes": 0,
"upvoters": [ "[email protected]", "[email protected]"],
"upvotes": 2,
"title": "best of the day",
"created": "2017-06-06T12:58:40.204Z"
},
{
"_id": "5936a70095e3a85804aae050",
"user": {
"_id": "58072aba0f82a61823c434df",
"displayName": "Table 1",
"roles": ["admin"],
"profileImageURL": "./modules/users/client/img/ownprofile/uploads/1f08308f43b0674d61a2cc5d95deb5ef",
"email": "[email protected]",
"categories": []
},
"__v": 1,
"openeyers": ["[email protected]"],
"openeyes": 1,
"upvoters": ["[email protected]","[email protected]", "[email protected]"],
"upvotes": 0,
"title": "he is best",
"created": "2017-06-06T12:58:40.204Z"
}]
- いずれかが解決策を知っている場合は厳密解を知っているだけでなく
my plunker
を更新してください感謝
あなたはグローバルとローカル変数に詰まっているようです。 –
質問は配列です。あなたはどのインデックスを参照しようとしていますか? – Vivz
@Vivzあなたのご意見ありがとうございます、私はあなたの答えを試してみましたが、可能ならば、私のプランカの感謝を更新します –