在自定义的fancybox(也称为lightbox,对话框)中,我使用插值值显示内容。
在服务中,在“打开”fancybox方法中,我这样做:
open: function(html, $scope) {
var el = angular.element(html);
$compile(el)($scope); // how to know when the $compile is over?
$.fancybox.open(el); // the uncompiled is shown before the compiled
}
问题在于对话框中的内容在$compile结束之前被加载,因此不到一秒钟后就会刷新对话框内容,并显示相应的值。
这个plunkr可以工作,但我想避免在完全编译之前显示"el":我只想在$compile完成后再显示它
有没有办法知道$compile何时结束,以便我在那之后才在fancybox中显示内容?
ng-click
收到了警报... 需要更多解释。 - charlietfl