Exam Development

Configuration

The sandbox directory is your development environment. This is where you will setup your exam environment for development and deployment.

Config.json

Hammer's config is built with JSON. The config is built with a cascading tree. It allows overriding default options provided by packages. The config defines:

  • Any options to be used within the environment
  • The packages to load and their options
Constants

Constants are used by to create reusable variables that can be consumed in the config files. The constants packagesUrl and resourcesUrl are required. They are used internally by other packages. All other variables have been optionally added to aid in compiling the configurations files or to be used as shortcuts as seen in this file. To reference a constant use {single curly braces} and the name of the constant. Constants can reference other constants to build more complex paths.

Modules

Modules are AngularJS Modules you need included in the boostrap. Packages using 3rd-party angular libraries will already include their dependencies. You only need to add to this section, if you are including a third party component as part of your exam.

Assets

Assets are a list of files that you would like to have preloaded before the exam is initialized. CSS and JS files are currently supported. However, it should be noted that best practices would have you load JS and CSS using the index.html file. More on this subject can be found in the section "Adding 3rd Party libraries".

Options

These are options are used by for your project and packages. Some packages will use these options to determine their behavior. See the documentation for each package for details.

Packages

Packages are loaded by being defined in this section. Many packages will have default options defined in their own config.json file. You can override these options by defining a property with the same name under the package's "options" property.

Alternative Configs

Hammer allows you to change the configuration on-the-fly by using the config URL query param. The default section is labeled under default. If you want to define another section, just add another name, as a sibling to default. You are not required to duplicate the all the the properties. Your settings will extend the default properties.

To test your alternative configs, just add the query param config to your URL, like so:
http://path/to/project/sandbox/index.html?config=<config_name>

timer Exercise: Hide Calculator

In this exercise, you will hide the calculator button from the header using the config file.

Launch in your browser http://localhost:8080/sandbox/#/examples/mch. You will notice a calculator icon. If a user clicks on the calculator, a calculator widget pops up. This is used by some exams but not all. You can hide the calculator in sandbox/config.json.

Open sandbox/config.json, and change showCalculator to false like so:

"options": {
    "authenticate": true,
    "localMode": false,
    "showDebug": false,
    "showEditor": false,
    "showCalculator": false
},

Once you refresh your browser, you will see the calculator icon is no longer visible.