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

compositeIndex is undefined #44

Open
@heck4

Description

@heck4

I had a situation where I was loading the view, and the div containing the snapscroll was initially not shown. The user clicks on a tab in the page, and then the div is shown. When I attempt to use the wheel to scroll, it threw an error on line 453:

var snapIndex = scope.compositeIndex[0];

compositeIndex was undefined.

When I loaded the view and had the div with angular scroll shown on init... it triggered a call to snapIndexChanged which initialized the scope's compositeIndex on line 348:

scope.compositeIndex = [current, 0];

So it seems like you're using a Changed event to do some initialization. My workaround was this ng-init hack:

<div class="element-template-bars" snapscroll="" snap-index="0" ng-init="$$childHead.compositeIndex= [0, 0];" snap-duration="300" scroll-delay="false" enable-arrow-keys="true" prevent-double-snap-delay="150">

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions