如何使此过滤器正常工作?
<div ng-repeat="rvs in reviews | filter:{ Name:'{{ r.Name }}' }">
{{ rvs.Name }}
</div>
'r.Name'来自其他数组“r in restaurants”
但是,而不是直接放置字符串的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"
}
]
}
答案 0 :(得分:1)
从<div ng-repeat="rvs in reviews | filter:{ Name: r.Name }">
{{ rvs.Name }}
</div>
$('#lol').text(price + '€ - ' + nbweek + 'semaine - ' +
var temp = (this.value * nbweek) + 'GB');
var nbweek = $('#weeknb');