Naimikan / angular-mapboxgl-directive

AngularJS directive for Mapbox GL
https://naimikan.github.io/angular-mapboxgl-directive/
MIT License
49 stars 21 forks source link

Question: Clean source and layer #46

Closed BohdanKorinnyi closed 6 years ago

BohdanKorinnyi commented 6 years ago

Hi @Naimikan ! I try to remove all layers from from the map but in some reason it doesn't work.

I have the following sources

$scope.glSource

In order to remove all source I do:

$scope.glSource = []

After that I try to add a source with id that was in $scope.glSource before removing I receive an error because the souce already exists with such id.

How can I remove source/layer correctly?

Naimikan commented 6 years ago

Hi @BohdanKorinnyi!

Could you provide me a codepen with an example?

Thank you!

Naimikan commented 6 years ago

Hi @BohdanKorinnyi!

You can remove sources and layers with:

$scope.glSources = []; // Sources
$scope.glLayers = []; // Layers

But remember, you have to remove sources and layers to clean all correctly.

Tell me if it worked!

BohdanKorinnyi commented 6 years ago

@Naimikan Thank you! It works for me!