-
Notifications
You must be signed in to change notification settings - Fork 27.4k
ngRepeat: property names starting with "$" will not be rendered #6266
Comments
hey @mgmeyers! thanks for submitting this issue! however, i think the cost of implementing this would out-weigh the benefits. is there a specific scenario where you are being forced to use a hash with a key that begins with a '$'? if so, please reply back and we can reopen and discuss. |
Yes, there are many. $ is a common prefix for other frameworks that work with front end frameworks like Angular. That makes angular useless in creating dashboard config panels, route configuration for other software, JSON editors used for many many developments |
I believe this should be fixed, or at least discussed more |
fiddle updated to 1.3.0: http://jsfiddle.net/takvg/4/ |
maybe we could make stuff we want to hide non-enumerable properties and have ng-repeat ignore those. that would be a small code change, but the side-effects are hard to estimate, so let's not do this in 1.3.0. |
Has anyone found a workaround to this? Or is fix? |
@sunnypatel Workaround is easy: just make your ng-repeat on Object.keys(myObject) |
@sunnypatel here is example of @frfancha : https://jsfiddle.net/takvg/5/ |
+1 |
+1 |
is there a workaround for key-value pairs , where one of the keys is $ , and we want to display both key and value. (in the example fiddle provided by Dhumez, we are only displaying keys) |
@gaurav5430 here is a workaround for key-value pairs. |
This would require a change in angular.equals, which could possibly affect many apps negatively at this point of the AngularJS lifecycle. Closing as wontfix |
In case anyone else stumbles upon this issue, this is my workaround: I just added a null character at the front of the String value used for the key when building the object. Seems to work just fine (so far). |
When using ngRepeat to iterate over an object, it will not output any key-value pair where the key starts with a dollar sign ($).
Here is a demo:
http://jsfiddle.net/takvg/4/
And, the actual code in question can be found here: https://github.com/angular/angular.js/blob/master/src/ng/directive/ngRepeat.js#L284
Specifically:
I'm assuming this is to prevent angular's internal properties from being iterated over by ngRepeat. I would suggest removing this limitation, but I don't know enough about the internals or the reasoning behind this to know what effect that might have.
The text was updated successfully, but these errors were encountered: