将范围发送到 onRegionTipShow

send scope into onRegionTipShow

我正在开发 Angular 应用程序,我想使用 jvectorMap 从 Jquery 到 Angular。

我发现 angular 可以使用 JvectorMap 所以我做了那个代码:angular with jvectorMap

我正在注意重现this comportement

我可以在指令中获取请求和数据。我只是不知道我应该怎么做才能使弹出窗口正常工作。

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');
                        }
                    });
                });
            }
        };
    }
    );

显示: