January 2016
Intermediate to advanced
416 pages
8h 54m
English
When we linked require.js to our application, we told it to use main.js as our entry point. To test that this works, let's start by entering a dummy main.js. JavaScript files in Play applications go in /public/javascripts:
// public/javascripts/main.js
require([], function() {
console.log("hello, JavaScript");
});To verify that this worked, head to 127.0.0.1:9000 and open the browser console. You should see "hello, JavaScript" in the console.
Let's now write a more useful main.js. We will start by configuring RequireJS, giving it the location of modules we will use in our application. Unfortunately, NVD3, the graph library that we use, does not play very well with RequireJS so we have to use an ugly hack to make it ...
Read now
Unlock full access