Filtering and Periods in Object Keys #6005
Description
Hi folks,
I'm putting together a front-end for interacting with an API. The results coming from the API are namespaced based on the database tables behind the API(also being developed). During development we were naming fields like so: "table.field" to similarly match our database schema. We're doing this to avoid collisions in denormalized data. In using this naming scheme I stumbled upon what I think is a bug with ng-repeat and filtering if an object's keys have periods in them.
Here's a basic, working ng-repeat:
<input type="text" ng-model="abc.label">
<ul>
<li ng-repeat="item in Array | filter: abc)">{{item.label}}</li>
</ul>
And here's a broken one. Let's say though that the object's key wasn't "label", but rather "meta.label":
<input type="text" ng-model="abc['meta.label']">
<ul>
<li ng-repeat="item in Array | filter: abc)">{{item['meta.label']}}</li>
</ul>
These two examples have different behavior. It appears that the key that you're filtering on in the objects in the array cannot have a period in it. If it does have a period, the initial set will show, but as soon as the model value changes the set is truncated. Curiously even when the model's "meta.label" property is cleared, the set is still truncated.
I put together an interactive example of two ng-repeats, one over an array with objects with periods in its keys, and one over an array of objects without periods in its keys. You can see it here.
For the time being I'm going to have our API return data namespaced as "table/field", which seems to work as expected.