0

我对使用编译模板的角度传单自定义弹出框有个疑问。 我使用离子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事件永远不会触发,我觉得现在的问题可能来自编译过程。任何建议表示赞赏。谢谢。

回答

0

在角瓣叶指令,

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

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