Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

ng-repeat won't work if my object keys starting with "$" and there is no error messages #11379

Closed
@puncha

Description

@puncha
<div ng-app='app'>
  <h1 ng-repeat='(key,val) in {"SimpleKey":"This works fine"}'>{{key}}:{{val}}</h1>
  <h1 ng-repeat='(key,val) in {"Key/$/FOO":"This works fine"}'>{{key}}:{{val}}</h1>
  <h1 ng-repeat='(key,val) in {"$/FOO":"This does NOT work fine!"}'>{{key}}:{{val}}</h1>
</div>

The related codes in angularjs:

if (collection.hasOwnProperty(key) && key.charAt(0) != '$') {
    collectionKeys.push(key); 
}

IMO, this is a limitation or a bug in AngularJs side. It is very inconvenient because each time to use ng-repeat to iterate over object keys, we need to ensure each key not start with $, or it won't work and there is no error messages.

Also there is a post on stackoverflow:
http://stackoverflow.com/questions/29141277/angularjs-ng-repeat-doesnt-work-if-the-key-starts-with

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions