1

我需要在所有节点上搜索,但在这里我有两个同名的标题(SameTitle)demolist.js。我想在整个节点上进行搜索操作。

预期结果: (SameTitle) 应出现两次,其父名称如demolist.js.

但它只出现一次,第一个 Node 父名称。有没有办法解决这个问题?

(function() {
angular.module('demoApp.list',[])
.value('MyList',[
{
  "id": 1,
  "title": "ASD Headquarters",
  "items": [
    {
      "id": 11,
      "title": "SameTitle",
      "items": [
        {
         "id":13,
         "title":"Jensen Chapman's Team",
         "items": [
            {
              "id":14,
              "title":"Jimmy John"
            },
            {
              "id":15,
              "title":"Daniel Mills"
            }
            ,
            {
              "id":16,
              "title":"Chris Boden"
            }
           ]
        }
        ],
    },
    {
      "id": 12,
      "title": "Irvine",
      "items": [
        {
         "id":23,
         "title":"Tracey Chapman's Team",
         "items": [
            {
              "id":24,
              "title":"San Jesus"
            },
            {
              "id":25,
              "title":"Fat Albert"
            }
            ,
            {
              "id":26,
              "title":"Connor McDavid"
            }
           ]
        }
        ]
    },
    {
      "id":30,
      "title":"San Diego",
      "items": [{
        "id":31,
        "title":"Duran Duran's Team",
        "items":[
             {
              "id":32,
              "title":"Amberlynn Pinkerton"
            },
            {
              "id":33,
              "title":"Tony Mejia"
            }
            ,
            {
              "id":34,
              "title":"Richard Partridge"
            }
            ,
            {
              "id":35,
              "title":"Elliot Stabler"
            }
          ]
        },
        {
        "id":40,
        "title":"Steely Dan's Team",
        "items":[
             {
              "id":36,
              "title":"Tony Stark"
            },
            {
              "id":37,
              "title":"Totally Rad"
            }
            ,
            {
              "id":38,
              "title":"Matt Murdock"
            }
            ,
            {
              "id":39,
              "title":"Stan Lee"
            }
          ]
        }
      ]
    }
  ]
},{
  "id": 2,
  "title": "ASD",
  "items": [
    {
      "id": 122,
      "title": "SameTitle",
      "items": [
        {
         "id":123,
         "title":"Jensen Chapman's Team",
         "items": [
            {
              "id":124,
              "title":"Jimmy John"
            },
            {
              "id":125,
              "title":"Daniel Mills"
            }
            ,
            {
              "id":126,
              "title":"Chris Boden"
            }
           ]
        }
        ],
    },
    {
      "id": 127,
      "title": "Irvine",
      "items": [
        {
         "id":128,
         "title":"Tracey Chapman's Team",
         "items": [
            {
              "id":129,
              "title":"San Jesus"
            },
            {
              "id":130,
              "title":"Fat Albert"
            }
            ,
            {
              "id":140,
              "title":"Connor McDavid"
            }
           ]
        }
        ]
    },
    {
      "id":320,
      "title":"San Diego",
      "items": [{
        "id":235,
        "title":"Duran Duran's Team",
        "items":[
             {
              "id":855,
              "title":"Amberlynn Pinkerton"
            },
            {
              "id":963,
              "title":"Tony Mejia"
            }
            ,
            {
              "id":874,
              "title":"Richard Partridge"
            }
            ,
            {
              "id":8645,
              "title":"Elliot Stabler"
            }
          ]
        },
        {
        "id":946,
        "title":"Steely Dan's Team",
        "items":[
             {
              "id":878,
              "title":"Tony Stark"
            },
            {
              "id":020,
              "title":"Totally Rad"
            }
            ,
            {
              "id":29526,
              "title":"Matt Murdock"
            }
            ,
            {
              "id":874,
              "title":"Stan Lee"
            }
          ]
        }
      ]
    }
  ]
}
]);

})()

解决这个问题

4

0 回答 0