为什么抗衡显示角度多时间,而使用Ajax调用? [英] why contend show multiple time in angular while using ajax call?

查看:132
本文介绍了为什么抗衡显示角度多时间,而使用Ajax调用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的演示二题。我想提出过。我弹出应的图标点击(这里用星形图标)打开。当我点击星形图标我能看到弹出屏幕,我想,但问题是,当我点击另一个图标/星形图标打开它弹出另一个在不关闭第一个弹出那儿过夜需要时间来显示超过一弹出。

I have two problem in my demo .I am making a pop over .I should open on icon click(here is used star icon).when i click star icon I am able to see pop up screen as I want but problem is that when I click another icon /star icon it open another pop over without closing the first one pop over.I need to display pop over one at time..


  • 1),我们可以显示弹出超过一次。它在只显示一个弹出
    在同一时间。

  • 1 ) can we show pop over one at one time .it show only one pop over at one time.

2),当我包括我的plunker(tooltip.js和弹出插件以上)。它显示争夺上的鼠标悬停事件。但如果我删除的点击事件为什么?

2)when I include in my plunker (tooltip.js and pop over plugin).It show the contend on mouseover event .but when i remove this it show on click event why ?

下面是plunker使用脚本工具提示和酥料饼。显示上点击?

Here is plunker with scripts tooltip and popover .display on click ?

http://plnkr.co/edit/OYiawflIBnpJ1PKx02LG?p=$p$ PVIEW

是在事件为什么这些Mouser的插件显示的plunker?
http://plnkr.co/edit/OYiawflIBnpJ1PKx02LG?p=$p$pview

here is the plunker with these plugin display on mouser over event why ? http://plnkr.co/edit/OYiawflIBnpJ1PKx02LG?p=preview

 <script src="https://dl.dropboxusercontent.com/s/a98aey2mlu0h511/bootstrap-tooltip.js"></script>
 <script src=" https://dl.dropboxusercontent.com/s/s1imyubboz1qjtl/bootstrap-popover.js?m="></script>

推荐答案

那么,如果你还在处理问题,以下是解决方案。虽然我不知道这是做它作为我开始与 AngularJS 的最佳方式。

Well if you are still working on the problem, following is the solution. Though I am not sure if this is the best way to do it as I'm starting with AngularJS.

var getTemplate = function(contentType, scope, element) {

    var template = $templateCache.get("templateId.html");

    $.ajax({
        type: "GET",
        url: 'pop.html',
        dataType: 'html',
        success: function(data) {
          var options = {
            content: data,
            placement: "right",
            html: true,
            date: scope.date,
        };
    $(element).popover(options);

    //FIND ALL POPOVERS AND HIDE THEM EXCEPT CURRENT ONE//
    $(element).on("show.bs.popover",function(t,e){
      $("span[mypopover]").not(this).popover('hide');
    });

  },
  error: function(data) {
    alert(data);
  }
    });

    return template;
};

以下是行:

$(element).on("show.bs.popover",function(t,e){
    $("span[mypopover]").not(this).popover('hide');
});

Plunker: http://plnkr.co/edit/WM0K8sdPVHSNeuIlLBim

这篇关于为什么抗衡显示角度多时间,而使用Ajax调用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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