本文介绍了AngularJS的fancybox弹出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经开始了angularjs项目,我想实现的fancybox。
I have started an angularjs project and I would like to implement fancybox.
对于这一点,我已经包括jQuery和插件的fancybox的解决方案。我试图打开一个窗口的fancybox如下所示在code中的模板。
For this, I have included the jQuery and fancybox plugins to the solution. I am attempting to open the template in the code shown below in a fancybox window.
查看
< A HREF =NG点击=openPage('弹出/ add.html')>添加< / A>
控制器
app.controller('MainController',
function MainController($scope) {
$scope.user = "Hey Welcome";
$scope.open = function(template_path){
$.fancybox({"href":template_path})
}
}
)
和弹出/ add.html
<div class="pop-contnr">
<h2>ADD</h2>
<table>
<thead>
<tr>
<th align=center>{{user}}</th>
</tr>
</thead>
</table>
</div>
的fancybox成功打开包含模板窗口,但 {{}用户}
前pression尚未评估。任何人都可以请帮助?
Fancybox successfully opens a window containing the template, but the {{user}}
expression has not been evaluated. Can anyone please help?
推荐答案
我已经创建了一个的fancybox指令
I have created a directive for fancybox
app.directive('fancybox',function($compile, $timeout){
return {
link: function($scope, element, attrs) {
element.fancybox({
hideOnOverlayClick:false,
hideOnContentClick:false,
enableEscapeButton:false,
showNavArrows:false,
onComplete: function(){
$timeout(function(){
$compile($("#fancybox-content"))($scope);
$scope.$apply();
$.fancybox.resize();
})
}
});
}
}
});
这篇关于AngularJS的fancybox弹出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!