Last active
December 17, 2015 20:29
-
-
Save mdonkers/5668300 to your computer and use it in GitHub Desktop.
Provided combination of 'routes' and Application does not seem to work.
Problem loading Angular JavaScript, the commented line (fetching from googleapis) works, but the routes.Assets include does not work. Results in syntax error on '<'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Application extends Controller { | |
def index(path: String) = Action { | |
Ok(views.html.main()) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@() | |
<!DOCTYPE html> | |
<html ng-app> | |
<head> | |
<title>Pissalot Application</title> | |
<meta charset="utf-8" /> | |
<link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/main.css")"> | |
<link rel="shortcut icon" type="image/png" href="@routes.Assets.at("images/favicon.png")"> | |
@*<script src="@routes.Assets.at("javascripts/jquery-1.9.0.min.js")" type="text/javascript"></script>*@ | |
@*<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>*@ | |
<script src="@routes.Assets.at("javascripts/angular.min.js")"></script> | |
</head> | |
<body> | |
<div> | |
<label>Name:</label> | |
<input type="text" ng-model="yourName" placeholder="Enter a name here"> | |
<hr> | |
<h1>Hello {{yourName}}!</h1> | |
</div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GET /assets/*file controllers.Assets.at(path="/public", file) | |
GET / controllers.Application.index(path = "") | |
GET /*path controllers.Application.index(path) |
I think your second line in the routes catches all URLs and passes them to your index method. Have you tried adding something like:
GET /assets/*file controllers.Assets.at(path="/public", file)
to the routes file, and load your JS with /assets/javascripts/etc... ? You should put it at the top of your current routes, otherwise the catch-all route kicks in before the Assets controller.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Make sure to put the path matching with '*' wildcard last, gave strange errors...