Skip to content

Conversation

@wylieconlon
Copy link

This error can happen when using ui-router, as ui-router will manage
your application lifecycle incorrectly. See this issue for more
information:

angular-ui/ui-router#881

I have not managed to create a reproducible test case for the bug, but the error message that this prevents is:

Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.

I will provide a test case if possible.

This error can happen when using ui-router, as ui-router will manage
your application lifecycle incorrectly. See this issue for more
information:

angular-ui/ui-router#881
@wylieconlon
Copy link
Author

I've discovered the cause of the error is this bug: angular/angular.js#9281

I also have a jsbin of the bug, which notably has nothing to do with angular-leaflet-directive. http://jsbin.com/kusexa/1/edit

If you upgrade the version of angular in the jsbin to 1.3.3, the problem disappears. Since it's not actually related to this project, I will close this request.

@tombatossals
Copy link
Owner

Thanks so much for reporting and share your conclusions.

@khfayzullaev
Copy link
Contributor

@wylieconlon With AngularJS v.1.3.6, I still see this issue. Any ideas?

@wylieconlon
Copy link
Author

@khfayzullaev I'm not sure, my issue was fixed completely because of the fix contained in angular/angular.js#9281

@khfayzullaev
Copy link
Contributor

@wylieconlon @tombatossals Using this 380b039 solved my issue. Basically, it seems that leafletData.getMap() guarantees that the map is deleted once! Or can we just listen for element.on($destroy)? Like:

element.on('$destroy', function() {
    map.remove();
    leafletData.unresolveMap(attrs.id);
});

It is triggered when the map is removed from the DOM. And we are not creating any new scope in the directive, so we do not have to worry about that.

@tombatossals
Copy link
Owner

👍 Totally right, thanks @khfayzullaev

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

Successfully merging this pull request may close these issues.

3 participants