角度传单指令自定义弹出窗口

时间:2016-11-16 09:53:20

标签: javascript angularjs ionic-framework leaflet angular-leaflet-directive

我有一个关于角度传单指令使用编译模板定制弹出窗口的问题。 我使用离子1.2.4,角度小叶指令0.10.0和小册子1.0.0rc-1。

在控制器中,我编写了以下代码。

var marker = {
            type: markerType,
            lat: myLatlng[0],
            lng: myLatlng[1],
            id: id,
            getMessageScope: function () { return $scope; },
            message: "<a ng-click=\"alert()\">howdy</a>",
            compileMessage: true
        };

        $scope.markersArray.push(marker);


$scope.alert = function(){
            console.log("hahahahaha[");
        }

以下是小提琴链接:http://jsfiddle.net/caiczcz/m7g8Le0L/1/

虽然链接显示在弹出窗口中,但是从不触发click事件,我认为问题可能来自编译过程。任何建议表示赞赏。 THX。

1 个答案:

答案 0 :(得分:0)

在Angular-leaflet-directive中,

 $timeout(function(){
             $compile(marker._popup._contentNode)(markerScope);
           });

这会引入一个闪烁问题,可以通过在弹出窗口显示或添加一些动画添加超时来解决,.etc。

相关问题