Understanding the AMD approach
We are going to look into the concept of what makes an AMD-style website. The point of this approach to sites is to pull content on demand. The content, or modules as they are defined here, does not need to be loaded in a particular order. If there are pieces that depend on other pieces, that is, of course, managed. We will be using the RequireJS library to manage this part of our code.
We will create four files in this example, as follows:
amd.html
amd.config.js
pick.js
pick.html
In our AMD page, we are going to create a configuration file for our RequireJS functionality. That will be the amd.config.js
file mentioned in the aforementioned list. We will start by creating this file with the following code:
// require.js settings var require = { baseUrl: ".", paths: { "bootstrap": "/share/js/bootstrap.min", "jquery": "/share/js/jquery.min", "knockout": "/share/js/knockout", "text": ...