Git Product home page Git Product logo

Comments (5)

Kollibri avatar Kollibri commented on May 28, 2024

I got this working by making the following changes:

In esriLegend.js I modified the watch method to be as follows:

scope.$watchCollection(function () { return mapController.getLayerInfos(); }, function (newValue, oldValue, scope) {
                              legend.refresh(newValue);
                          });

In esriMap.js I modified the "addLayerInfo" and "getLayerInfos" calls to use a scope variable instead of "this".

this.addLayerInfo = function (lyrInfo) {
                    return self.getMap().then(function (map) {
                        if (!$scope.layerInfos) {
                            $scope.layerInfos = [lyrInfo];
                        } else {
                            $scope.layerInfos.push(lyrInfo);
                        }
                        return $scope.layerInfos;
                    });
                };
                this.getLayerInfos = function () {
                    return $scope.layerInfos;
                };

Now it is watching the layerInfos object for changes and updating the legend appropriately. I'm not sure if this is the "right" way to do it or not. But it works.

from angular-esri-map.

tomwayson avatar tomwayson commented on May 28, 2024

@Kollibri

Would you be willing to make a pull request of your changes so that it is easier for me to review the code.

from angular-esri-map.

Kollibri avatar Kollibri commented on May 28, 2024

Yes I am willing I'm just not very experienced with git so will have to spend a little time on that first. Will try to get this up to you within a few days.

from angular-esri-map.

Kollibri avatar Kollibri commented on May 28, 2024

#52 PR is made.

from angular-esri-map.

tomwayson avatar tomwayson commented on May 28, 2024

Added in #52

Thank you @Kollibri.

from angular-esri-map.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.