在我之前的 Play 应用程序中,我曾经使用 Webjars 和 RequireJS 来管理依赖项。我可以毫无问题地使用 require(['angular', 'webjars!ui-bootstrap-tpls.js'], function(angular) {...}) 。
最近我在 www.webjars.org 上更新了 webjars 和几个 webjars 相关的 deps(webjars-ui-bootstrap 等)到最新版本,我找到了 webjars!加载程序插件无法正常工作。我检查了 webjars-seed-play 应用程序并修改了一些代码,例如:
require(['angular', './controllers', './directives', './filters', './services', 'angular-route', 'webjars!ui-bootstrap-tpls.js'],
function (angular, controllers) {
// Declare app level module which depends on filters, and services
angular.module('myApp', ['myApp.filters', 'myApp.services', 'myApp.directives', 'ngRoute', 'ui.bootstrap']).
config(['$routeProvider', function ($routeProvider) {
$routeProvider.when('/view1', {templateUrl: 'partials/partial1.html', controller: controllers.MyCtrl1});
$routeProvider.when('/view2', {templateUrl: 'partials/partial2.html', controller: controllers.MyCtrl2});
$routeProvider.otherwise({redirectTo: '/view1'});
}]);
angular.bootstrap(document, ['myApp']);
});
它只是抱怨 ui.bootstrap 不可用,我认为应该由 webjars!ui-bootstrap-tpls.js 加载。我在这里做错了什么?请帮我。谢谢。
我在 build.sbt 中的部门:
libraryDependencies ++= Seq(
"org.webjars" %% "webjars-play" % "2.2.1-2",
"org.webjars" % "angularjs" % "1.2.13",
"org.webjars" % "bootstrap" % "3.1.1",
"org.webjars" % "requirejs" % "2.1.11-1",
"org.webjars" % "angular-ui-bootstrap" % "0.10.0"
)