Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Play221 Update #7

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name := "angularjs_sample"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please keep the name as "angular-seed-play"?


version := "1.0-SNAPSHOT"

libraryDependencies ++= Seq(
jdbc,
anorm,
cache,
"org.webjars" %% "webjars-play" % "2.2.1",
"org.webjars" % "angularjs" % "1.2.9",
"org.webjars" % "requirejs" % "2.1.10"
)

play.Project.playScalaSettings
15 changes: 0 additions & 15 deletions project/Build.scala

This file was deleted.

2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.12.4
sbt.version=0.13.0
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ logLevel := Level.Warn
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

// Use the Play sbt plugin for Play projects
addSbtPlugin("play" % "sbt-plugin" % "2.1.3")
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.1")
5 changes: 3 additions & 2 deletions public/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ define('angular', ['webjars!angular-locale_en-us.js'], function() {
return angular;
});

require(['angular', './controllers', './directives', './filters', './services'],

require(['angular', './controllers', './directives', './filters', './services', 'webjars!angular-route.js'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @huntc, how does just angular work? I thought the webjars! prefix was needed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is defined above:

https://github.com/typesafehub/angular-seed-play/pull/7/files#diff-f5260081ec80c28a01bd5809279dbfa4L7

I've found it good practice to do this in order to:

  • not have webjars! throughout my code (and thus keep it portable); and
  • have the module return something that makes sense rather than rely on globals throughout my code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. Thanks.

function(angular, controllers) {

// Declare app level module which depends on filters, and services

angular.module('myApp', ['myApp.filters', 'myApp.services', 'myApp.directives']).
angular.module('myApp', ['myApp.filters', 'myApp.services', 'myApp.directives', 'ngRoute']).
config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/view1', {templateUrl: 'partials/partial1.html', controller: controllers.MyCtrl1});
$routeProvider.when('/view2', {templateUrl: 'partials/partial2.html', controller: controllers.MyCtrl2});
Expand Down