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

Error: that.indicators is undefined #13

Open
Nevergonnachange opened this issue Jun 8, 2015 · 4 comments
Open

Error: that.indicators is undefined #13

Nevergonnachange opened this issue Jun 8, 2015 · 4 comments

Comments

@Nevergonnachange
Copy link

Hi,

I am expiriancing the following problem once I set refreshInterval: 500. Everything works fine ultil I leave the route, the scroller is on ( change route, template and ctrl ).

Then i get the following error messages:

Firefox:
"Error: that.indicators is undefined
_indicatorsMap@http://ngc:61741/libs/iscroll.js:974:14
IScroll.prototype._initIndicators/<@http://ngc:61741/libs/iscroll.js:1007:4
IScroll.prototype._execEvent@http://ngc:61741/libs/iscroll.js:739:1
IScroll.prototype.refresh@http://ngc:61741/libs/iscroll.js:698:3
_refreshAfterInitialRender@http://ngc:61741/libs/angular-iscroll.js:121:17
timeout/timeoutId<@http://ngc:61741/libs/angular.js:16299:28
completeOutstandingRequest@http://ngc:61741/libs/angular.js:4924:7
Browser/self.defer/timeoutId<@http://ngc:61741/libs/angular.js:5312:7
"

Chrome
TypeError: Cannot read property 'length' of undefined
at _indicatorsMap (iscroll.js:974)
at Object. (iscroll.js:1007)
at Object.IScroll._execEvent (iscroll.js:739)
at Object.IScroll.refresh (iscroll.js:698)
at _refreshAfterInitialRender (angular-iscroll.js:121)
at angular.js:16299
at completeOutstandingRequest (angular.js:4924)
at angular.js:5312

Source:
https://gist.github.com/Nevergonnachange/7248c6e6d37d9881a3ac

EDIT:
Apparently the destruction / deregistration doesnt quite work out well here

angular.forEach(deregistrators, _call);

EDIT:

this is my fix:

line ~170
instance.on('scrollStart', _disableRefresh);
instance.on('scrollEnd', _enableRefresh);
if (options.directive.refreshInterval !== false) {
instance.refreshInterval = $interval(function () {
_refreshInstance();
}, options.directive.refreshInterval);
}

line ~144
function _destroyInstance() {
if (angular.isDefined(scope.iscrollInstance)) {
delete scope.iscrollInstance;
}
$interval.cancel(instance.refreshInterval);
instance.destroy();

@mtr
Copy link
Owner

mtr commented Jun 9, 2015

Hi.

I'm sorry, but I won't have time to look into this immediately. If you could create a working (breaking) example on http://jsfiddle.net/ and share that in this issue thread, that would reduce my work considerably. Could you please do that?

@Nevergonnachange
Copy link
Author

Im curently quite busy with work aswell. But I'll try to set up and example on the weekend if thats of any help for you.

@mtr
Copy link
Owner

mtr commented Jun 9, 2015

That would be great. It'll be much more precise, and require less questions and guessing.

@mikechamberlain
Copy link

I'm also getting this issue. Haven't been able to reproduce it consistently though, sorry.

The error occurs in iscroll-probe.js, line 983:

for ( var i = that.indicators.length; i--; ) { 

Looking further down at line 1021, I see:

this.on('destroy', function () {
    _indicatorsMap(function () {
        this.destroy();
    });
    delete this.indicators;
});

Does angular-iscroll end up trying to destroy the instance twice?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants