abelbryo / Angular-Play-Reactivemongo-Seed

Angular-Play2.3.2-Reactivemongo
GNU General Public License v3.0
0 stars 0 forks source link

Integrate with webjars: Error: [ng:areq] Argument 'fn' is not a function, got string #1

Open sgireddy opened 9 years ago

sgireddy commented 9 years ago

Hi!,

I am trying to integrate this project with webjars. here is what I did:

  1. Add the following to build.sbt "org.webjars" %% "webjars-play" % "2.3.0", "org.webjars" % "jquery" % "1.11.0", "org.webjars" % "requirejs" % "2.1.11-1", "org.webjars" % "underscorejs" % "1.6.0-3", "org.webjars" % "bootstrap" % "3.1.1-1" exclude("org.webjars", "jquery"), "org.webjars" % "angularjs" % "1.2.21" exclude("org.webjars", "jquery"), "org.webjars" % "angular-ui-router" % "0.2.10-1" exclude("org.webjars", "jquery"),
  2. Add the following to routes GET /webjars/*file controllers.WebJarAssets.at(file)
  3. Update javascript references in index.scala.html

    <script type="text/javascript" src="@routes.WebJarAssets.at(WebJarAssets.locate("jquery.js"))">

    <script type="text/javascript" src="@routes.WebJarAssets.at(WebJarAssets.locate("bootstrap.js"))"> <script type="text/javascript" src="@routes.WebJarAssets.at(WebJarAssets.locate("angular.js"))"> <script type="text/javascript" src="@routes.WebJarAssets.at(WebJarAssets.locate("angular-ui-router.js"))"> <script type="text/javascript" src="@routes.WebJarAssets.at(WebJarAssets.locate("angular-resource.js"))"> @<script src="@routes.Assets.at("third/jquery/jquery-1.10.2.min.js")" type="text/javascript">@ @<script src="@routes.Assets.at("third/bootstrap/js/bootstrap.min.js")" type="text/javascript">@ @<script src="@routes.Assets.at("third/angularjs/angular.min.js")" type="text/javascript">@ @<script src="@routes.Assets.at("third/angularjs/angular-resource.min.js")" type="text/javascript">@

Error: Uncaught Error: [$injector:modulerr] Failed to instantiate module app due to: Error: [ng:areq] Argument 'fn' is not a function, got string http://errors.angularjs.org/1.2.21/ng/areq?p0=fn&p1=not%20a%20function%2C%20got%20string at http://localh......0)

It seems I am doing everything correct but ended up with this issue. can you please help?

sgireddy commented 9 years ago

Git didn't like html references... please click edit to see the actual references.

abelbryo commented 9 years ago

I am new myself to angular and I haven't used webjars but the version of angular in the seed is 1.1.5. And your build says 1.2.21. Have you considered that? and AFAICS the seed uses angular-resources and angularjs. If you use ui-router I guess the app.config will be different.