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.

Truely empty objects in ngRepeat #1944

Closed
@spacenick

Description

@spacenick

Let's say I have a pseudo-hashmap built using Object.create(null) and I want to ng-repeat over it.
This is breaking :

<div ng-repeat="(key,value) in myHashmap"></div>

Because obviously my hashMap doesn't inherit the Object prototype and thus doesn't have the hasOwnProperty method.

Can be quickly fixed by changing the size function

if (!ownPropsOnly || Object.hasOwnProperty.call(obj,key))

and the ngRepeatDirective

if (Object.hasOwnProperty.call(collection,key) && key.charAt(0) != '$') {

However I'd love to have some feedbacks from the team if this is actually on purpose. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions