Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested array giving error #114

Open
celsomtrindade opened this issue Jan 24, 2017 · 0 comments
Open

Nested array giving error #114

celsomtrindade opened this issue Jan 24, 2017 · 0 comments

Comments

@celsomtrindade
Copy link

When I use a nested array, I keep getting an error on this line here:

var array = collection.filter(function(item){
    return !item.container;
}).map(function(item){
    return {
        part: item.getPart().id,
        y: item.element[0].getBoundingClientRect().top //Here is where the console point to
    };
});

My array looks like this:

[
    {
        "id":"1",
        "name": "Shoes",
        "items": [
            {"id":"1", ...},
            {"id":"2", ...},
            {"id":"3", ...},
        ]
    },
    {
        "id":"2",
        "name": "Dress",
        "items": [
            {"id":"4", ...},
            {"id":"5", ...},
            {"id":"6", ...},
        ]
    },
    {
        "id":"3",
        "name": "Tie",
        "items": [
            {"id":"7", ...},
            {"id":"8", ...},
            {"id":"9", ...},
        ]
    }
]

But the only one I want to filter is the main array, not the items. Everything works fine as expected. But there is this error appearing everytime I move an item. Like I said, this error is not stoping the sorting,drag, drop functionality, but still there is this error.

My HTML:

<section sv-root sv-part="vm.category" sv-on-sort="vm.sortList()">
    <div ng-repeat="item in vm.category track by item.id" sv-element>
        <div><h4>{{category.name}}</h4></div>

        <div class="row">
            <div class="col" ng-repeat="product in category.items"></div>
        </div>
    </div>
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant