我在使用 UI Bootstrap 时遇到了一个非常奇怪的问题。即使是最简单的例子也不起作用。这就是我的情况:
我有一个使用 yeoman 插件的 Play Framework 应用程序:https://github.com/tuplejump/play-yeoman 。它使用 AngularJS 和 Bootstrap。到目前为止,一切工作正常,但是当我尝试使用 http://angular-ui.github.io/ 中的 UI Bootstrap 库打开我的第一个模式时,出现了这些奇怪的错误。 。我使用了 http://angular-ui.github.io/bootstrap/#/modal 中的确切代码但不知何故它不起作用。这是打开我的模式的代码:
var modalInstance = $modal.open({
templateUrl: 'myModalContent.html',
controller: ModalInstanceCtrl,
size: size,
resolve: {
items: function () {
return ['item1', 'item2', 'item3'];
}
}
});
开发控制台中出现的错误是:
GET http://localhost:9000/ui/function%20(a,b)%7Breturn%20b.templateUrl%7C%7C%22template/modal/window.html%22%7D 404 (Not Found) angular.js:9499
Uncaught TypeError: undefined is not a function angular.js:9512
我针对类似问题尝试了很多解决方案,但没有一个有效。这就是我加载 ui-boostrap 的方式:
<script src="components/angular-bootstrap/ui-bootstrap-tpls.min.js"></script>
我已经寻找解决方案很长时间了,但我还没有遇到 URL 中的函数%20(a,b)%7... 的问题,并且所有解决方案都不起作用。任何帮助表示赞赏!
最佳答案
我也遇到了同样的问题,这似乎是版本冲突。我使用的是 Angular 版本 1.0.8 和 Angular Bootstrap 0.11.0。升级到Angular 1.2.21后,问题似乎已经解决。
关于angularjs - 在 Angular UI Bootstrap 中打开模式时出现 404 Not Found 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24647777/