AngularJS数组过滤器不起作用



我如何使这个过滤器工作?

<div ng-repeat="rvs in reviews | filter:{ Name:'{{ r.Name }}' }">
 {{ rvs.Name }}
</div>

' r。Name'来自其他数组"r in restaurants"

但是,与r.f 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.Name}}'中删除'{{}}'

<div ng-repeat="rvs in reviews | filter:{ Name:  r.Name  }">
 {{ rvs.Name }}
</div>

相关内容

  • 没有找到相关文章

最新更新