通过NG-视图包括不工作时的引导3手风琴AngularJS [英] AngularJS with bootstrap 3 accordion not working when included via ng-view

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

问题描述

问题是:当我用手风琴在在NG-观点指令加载的观点,手风琴标题点击不正常工作了。

The problem is the following: As soon as I use the accordion in a view that is loaded in the ng-view directive, the accordion title clicks dont work correctly anymore

<一个href=\"http://plnkr.co/edit/KGwuqDIb7I5NrYCtPOPk?p=$p$pview\">http://plnkr.co/edit/KGwuqDIb7I5NrYCtPOPk?p=$p$pview

如果手风琴是页面本身没有NG-视图使用,手风琴完美的作品

If the accordion is use in the page itself with no ng-view, the accordion works perfectly

<一个href=\"http://plnkr.co/edit/8dY7JU1kxjZ2jAKmMIrP?p=$p$pview\">http://plnkr.co/edit/8dY7JU1kxjZ2jAKmMIrP?p=$p$pview

任何线索,以什么即时通讯失踪?

Any clue to what Im missing?

推荐答案

的问题是,引导追加 #according_name 中的 A 标记。这会触发AngularJS路由和由于路由变化的test.html 重新装上每点击手风琴链接。

The problem is that Bootstrap appends #according_name within a a tag. This triggers a AngularJS routing and due to route change test.html is loaded again on every click on accordian link.

您的选择是尝试配置 $ locationProvider 使用HTML5模式hashbag,如果它的工作原理

Your options are to try to configure $locationProvider to use HTML5 mode with hashbag if it works

$locationProvider.html5Mode(true).hashPrefix('!');

在这里看到一些文件

其他的将是使用角UI组件,但一直没有移植到支持引导版本3。

Other would be to use angular-ui component but it has been not ported to support version 3 of bootstrap.

这篇关于通过NG-视图包括不工作时的引导3手风琴AngularJS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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