Angular ui-bootstrap 手风琴不起作用
直接从
复制的例子http://angular-ui.github.io/bootstrap/
根本不起作用,无论是在本地还是在 plunker 中.不知道为什么.Bootstrap CSS 已加载,ui-bootstrap-tpls.min.js 和 angular.min.js 也已加载(尽管 angular 本身运行良好).
这是plunker:
http://plnkr.co/edit/15GWWFSUwab4VmaxfFPf
我在浏览器中没有收到 js 错误,但它不起作用.
请帮忙.我需要在我的网站上使用它(即,即使我编写自己的 html/js 代码,手风琴也不起作用).
An example copied directly from
http://angular-ui.github.io/bootstrap/
Does not work at all, neither locally nor in plunker. Don't know why. Bootstrap CSS is loaded, so is ui-bootstrap-tpls.min.js and angular.min.js (angular itself is working just fine though).
Here's the plunker:
http://plnkr.co/edit/15GWWFSUwab4VmaxfFPf
I am getting no js errors in a browser, yet it's not working.
Please help. I need to get this working on my website (i.e. the accordion doesn't work even when I write my own html/js code).
从演示站点创建的 plunker 工作完美,刚刚从演示站点创建了一个 plunker:http://plnkr.co/edit/z9RQKgNBTRbigyQs7OGW?p=preview
A plunker created from the demo site works flawlessly, just created a plunker from the demo site: http://plnkr.co/edit/z9RQKgNBTRbigyQs7OGW?p=preview
在您的 plunker 中,您没有声明对 ui.bootstrap
模块的依赖,如演示页面最顶部所述:
In your plunker you are not declaring dependency on the ui.bootstrap
module as described on the very top of the demo page:
一旦您下载了所有文件并将其包含在您的您只需要声明对 ui.bootstrap 模块的依赖:angular.module('myModule', ['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']);
添加对上述模块的依赖后,您的 plunker 也能正常工作:http://plnkr.co/edit/00bK0rNDYIrH9a9TVRk3?p=preview
After adding a dependency on the mentioned module your plunker works as well: http://plnkr.co/edit/00bK0rNDYIrH9a9TVRk3?p=preview
还有一件事——你至少需要 AngularJS 1.0.5——早期版本的 AngularJS 中存在一些错误,导致该指令无法正常工作.
One more thing - you need at least AngularJS 1.0.5 - there were bugs in earlier versions of AngularJS that prevented this directive from working correctly.