0
如何讓這個濾波器工作?AngularJS陣列濾波器不能正常工作
<div ng-repeat="rvs in reviews | filter:{ Name:'{{ r.Name }}' }">
{{ rvs.Name }}
</div>
'r.Name' 來自其他陣列 「在餐館R」
然而,不是r.Name直接把字符串的作品,像這樣:
<div ng-repeat="rvs in reviews | filter:{ Name:'John' }">
{{ rvs.Name }}
</div>
陣文件
'評論'
{
"reviews": [
{
"Name": "Sagar Ratna",
"Reviewer": "Jaskaran",
"Comments": "Great service, healthy food!",
"Date": "25th Sept. 2016",
"Rating" : "4"
},
{
"Name": "The Night Factory",
"Reviewer": "Pawandeep",
"Comments": "Nice location, ok service!",
"Date": "29th Sept. 2016",
"Rating" : "3"
}
]
}
家
餐館
{
"records": [
{
"Name": "Sagar Ratna",
"Image": "./images/sr.jpg",
"Address": "Mohali",
"Type": "South Indian",
"Hours" : "10:00-23:30"
},
{
"Name": "The Night Factory",
"Image": "./images/nf.jpg",
"Address": "Chandigarh",
"Type": "South Indian",
"Hours" : "24/7"
}
]
}
'{{}}'
你可以在這裏把你的兩個陣列的評論和r? –當您位於角標記內時,您不需要使用鬍鬚{{}}。只嘗試'篩選:{名稱:'r.Name'}' –
@VaibhavPatil更新! –