Search code examples
jqueryangularjsjvectormap

send scope into onRegionTipShow


I'm working on a Angular app, i want to use jvectorMap from Jquery into Angular.

I have found that angular can use JvectorMap so i did that code : angular with jvectorMap

I was attenting to reproduce this comportement

I can get the request and the data in the directive. I just don't know what i'm suppose to do to make the pop up work.


Solution

  • app.directive('map',
        function map () {
            return {
                restrict: 'EAC',
                link: function (scope, element, attrs) {
                    scope.$watch("mapdata", function (n, o) {
                        $(element).empty();
                        $(element).width('auto');
                        $(element).height(600);
                        $(element).vectorMap({
                            map: 'world_mill_en',
                            series: {
                                regions: [{
                                    values: scope.mapdata,
                                    scale: ['#C8EEFF', '#0071A4'],
                                    normalizeFunction: 'polynomial'
                                }]
                            },
                            onRegionTipShow: function(e, el, code){
                                el.html(el.html()+' '+ upload.vectorMap('get', 'mapObject').series.regions[0].values[code] +' Photos');
                            }
                        });
                    });
                }
            };
        }
        );
    

    the display: onregiontipshow