AngularJS的UI手风琴指令不NG-视图中工作 [英] AngularJS-UI accordion directive not working with ng-view

查看:126
本文介绍了AngularJS的UI手风琴指令不NG-视图中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图角的UI引导手风琴在我的应用程序集成。它工作正常,如果我把它放在不NG-的看法,但如果我通过NG路由提供商把手风琴在其他一些HTML文件并加载与NG-观点手风琴无法工作。

I am trying to integrate Angular-ui bootstrap accordion in my application. It works fine if I put it without ng-view but if I put the accordion in some other html file and loads with ng-view via ng-route provider the accordion fails to work

我提到这个链接,但没有帮助对我来说这个解决方案
<一href=\"http://stackoverflow.com/questions/18803955/angularjs-with-bootstrap-3-accordion-not-working-when-included-via-ng-view\">AngularJS自举3手风琴不工作时,通过NG-视图包括

I referred this link but no help for me with this solution AngularJS with bootstrap 3 accordion not working when included via ng-view

下面是plunker链接。如果任何人都可以在此plunker给予修复?

Here is the plunker link. If anyone can give a fix on this plunker?

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

感谢

推荐答案

事实上,在你的答案下文称给出的答案是正确的。这简直是​​关系到你的模板中的一个标记有你不想火默认动作。

In fact the given answers in your reffered answer are right. This is simply related to the A tag in your template which has a default action you don't want to fire.

更改您的模板是这样的:

Change your template like this:

template:
    '<div class="panel panel-default">'+
    '   <div class="panel-heading">'+
    '       <h4 class="panel-title"><span  data-toggle="collapse" class="accordion-toggle">{{title}}</span></h4>'+
    '   </div>'+
    '   <div class="panel-collapse collapse">'+
    '       <div class="panel-body" ng-transclude>'+
    '       </div>'+
    '   </div>'+
    '</div>',

和使用范围,标签或按钮,而不是一个A的一切正常的。

and use a span, a label or a button instead of an A. An everything works.

请参阅此分叉 Plunker

您现在CANN使用一些额外的CSS来实现一些悬停效果。

You cann now use some additional css to achieve some hover effect.

这篇关于AngularJS的UI手风琴指令不NG-视图中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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