简体   繁体   中英

How to apply filter in Angular

I am new to Angular and would like to apply filter to this JSON to only get "place" objects.

   {
  "places": {
    "live": "true",
    "status": "default",
    "place": [
      {
        "-name": "Test",
        "-url": "http://myurl"
      },
      {
        "-name": "Test",
        "-url": "http://myurl"
      },
      {
        "-name": "Test",
        "-url": "http://myurl"
      }
    ]
  }
}

I was thinking of applying filter with something like this:

<div ng-repeat="place in places | filter:{place:'http'}">

This is clearly wrong . Is there a way to apply filter to only get "place" objects

<div ng-repeat="place in places.place">

我认为应该工作

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM