【问题标题】:Webjar not resolving in angular-seed-play projectWebjar 无法在 angular-seed-play 项目中解析
【发布时间】:2013-06-11 13:17:53
【问题描述】:

我目前正在使用 angular-seed-play,它非常方便,但在配置更多角度依赖项时遇到问题。

我想使用 Angular UI Bootstrap,但它不适合我。

我的 app.js 本质上是

define('angular', ['webjars!angular-locale_en-gb.js'], function() {
    return angular;
});

require(['angular', './controllers', './directives', './filters', './services', 'webjars!angular-ui.js'],

function(angular, controllers) {
    angular.module('myApp', ['myApp.filters', 'myApp.services', 'myApp.directives', 'ui.bootstrap']).
    config(['$routeProvider', function($routeProvider) {
  ....
}]);

这个结果

Uncaught No WebJar dependency found for angular-ui-bootstrap. Please ensure that this is a valid dependency

谁能指出我正确的方向?

【问题讨论】:

    标签: angularjs playframework-2.0 requirejs webjars


    【解决方案1】:

    可能缺少依赖项? angular-ui-bootstrap 与 AngularJS 是分开的。在您的 Build.scala 中,添加以下内容,然后运行 ​​play update

    val appDependencies = Seq(
     ...,
     "org.webjars" % "angular-ui-bootstrap" % "0.3.0-1" exclude("org.webjars", "angularjs")
    )
    

    app.js

    require(['angular', './controllers', './directives', './filters', './services', "webjars!ui-bootstrap.js", "webjars!ui-bootstrap-tpls.js"], function(angular, controllers, directives, filters, services) {
      angular.module("your.module", ["ui.bootstrap", "ui.bootstrap.tpls"]);
    }
    

    【讨论】:

    • 绝对需要依赖。还将要求更改为“require(['angular', './controllers', './directives', './filters', './services', 'webjars!ui-bootstrap-tpls']”。谢谢!
    • 对,我在答案中添加了这个。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-06-03
    • 1970-01-01
    • 1970-01-01
    • 2013-03-24
    • 1970-01-01
    • 2020-09-08
    • 1970-01-01
    相关资源
    最近更新 更多