2

Assume I have this in HTML

<div ng-repeat="tag in response.Tags | filter : searchKey">
</div>

Also I have a text input with searchKey model.

<input type="text" ng-model="searchKey">

response.Tags is an array of JSONs.

Now the problem is, there are some missing objects in UI populated by ng-repeat when its loaded by default. When I use the text input and filters the list, i can see the missing things.

What has gone wrong?

Note - there are no changes to the array. Elements are there. Once its loaded its not changed.

Edit This is raw data I receive. Could go up to 500 elements, nothing gets missed when there is only a few.

    {
"AlertCategoryID": 15,
"AlertName": "Disk Space Low",
"AlertType": "Warning",
"AlertMessage": "<data><summary>Available disk space (%) on drive _Total is less than 10%. Current value is 5%.</summary><detail></detail></data>",
"AlertTime": "2015-05-21T19:24:03"
    }, {
"AlertCategoryID": 15,
"AlertName": "Disk Space Low",
"AlertType": "Warning",
"AlertMessage": "<data><summary>Available disk space (%) on drive _Total is less than 10%. Current value is 5%.</summary><detail></detail></data>",
"AlertTime": "2015-05-21T19:22:05"
}

I use an XML parser to extract <summary> tag , also I intercept and removes the T between Date and Time; and assign these to the array which i will be using for ng-repeat.

I am showing the AlertName, Message and the Time of it in the UI.

I noted that the elements which tend to lose have a very large XML in the message tag. I dont know if it has to do with anything.

Dhanushka Dolapihilla
  • 1,115
  • 3
  • 17
  • 34

1 Answers1

1

If you want to filter based on specific key in the JSON object use following syntax

<div ng-repeat="tag in response.Tags | filter:{ AlertName: searchKey }">
kachhalimbu
  • 2,190
  • 17
  • 14