直接复制自的示例
http://angular-ui.github.io/bootstrap/
根本不起作用,无论是在本地还是在 plunker 中。不知道为什么。 Bootstrap CSS 已加载,ui-bootstrap-tpls.min.js 和 angular.min.js 也已加载(但 Angular 本身工作得很好)。
这是笨蛋:
http://plnkr.co/edit/15GWWFSUwab4VmaxfFPf
我在浏览器中没有收到 js 错误,但它不起作用。
请帮忙。我需要在我的网站上实现此功能(即,即使我编写自己的 html/js 代码, Accordion 也无法工作)。
最佳答案
从演示站点创建的 plunker 工作完美,刚刚从演示站点创建了一个 plunker:http://plnkr.co/edit/z9RQKgNBTRbigyQs7OGW?p=preview
在您的 plunker 中,您没有声明对 ui.bootstrap
模块的依赖,如演示页面最顶部所述:
As soon as you've got all the files downloaded and included in your page you just need to declare a dependency on the ui.bootstrap module: angular.module('myModule', ['ui.bootstrap']);
添加对上述模块的依赖关系后,您的插件也可以正常工作: http://plnkr.co/edit/00bK0rNDYIrH9a9TVRk3?p=preview
还有一件事 - 您至少需要 AngularJS 1.0.5 - 早期版本的 AngularJS 中存在错误,导致该指令无法正常工作。
关于angularjs - Angular ui-bootstrap Accordion 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17596580/