不angularjs NG-点击工作酥料饼内容 [英] Popover content not working with angularjs ng-click

查看:123
本文介绍了不angularjs NG-点击工作酥料饼内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读所有关于这个职位,但不幸的是他们都不是有帮助的:和的jsfiddle链接plunker似乎是不再工作。

I have already read all the posts about this, but unfortunately none of them was helpful: jsfiddle and plunker links appear to be no longer working.

我所试图做的是简单的把一个按钮里面白手起家弹出了,这使得要我创建了指令范围内的函数的调用。问题是,使用jQuery抢,因为范围似乎是外面这是行不通的内容。还试图创建函数里面的内容也不会工作,因为它会不会编译。

What I am trying to do is to simple put a button inside the bootstraps pop-over which makes a call to a function inside the scope of the directive I've created. The problem is that using jquery to grab the content it does not work since the scope appear to be outside. Also trying to create the content inside the function it won't work because it will be not compiled.

我创建了一个的jsfiddle例子,但不知何故angularjs在正确的点不加载,所以并不能工作。

I created an example on jsfiddle, but somehow angularjs is not loaded in the right point and therefore it doesn't work either.

 $("#pop-over-link").popover({
      'placement': 'top',
      'trigger': 'click',
      'html': true,
      'container': 'body',
      'content': function() {
           return $("#pop-over-content").html();
     }

});
这是一块在打开的弹出code的,抓住内容,并显示它。

}); This is the piece of code that opens the pop over, grabs the contents and shows it.

在这里的jsfiddle: http://jsfiddle.net/75zLT/2/

Here the jsfiddle: http://jsfiddle.net/75zLT/2/

在这里,我的Dropbox HTTPS工作的例子://dl.dropboxusercontent。 COM / U / 19470623 / hatethis / test.html的

And here the working example on my dropbox https://dl.dropboxusercontent.com/u/19470623/hatethis/test.html

推荐答案

有2个问题你不包括ngRoute在你的小提琴,你需要编译的内容在酥料饼返回。

There were 2 issues your were not including ngRoute in your fiddle and your need to compile the content returned in the popover.

'content': function() {
     return $compile($("#pop-over-content").html())(scope);
 }

此外,你不需要暂停。

Also you do not need the timeout.

例如: Plunker

这篇关于不angularjs NG-点击工作酥料饼内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆