Skip to end of metadata
Go to start of metadata

Demonstrates use of the Alloy configuration file.

App Folder Location

Icon

alloy/test/apps/basics/config_json

The Alloy configuration file is named config.json and located in the Alloy project's app directory. It's used to specify global variables, conditional environment and platform values, and widget dependencies. For a list of supported configuration values, see Project Configuration File.

At runtime, you can access a configuration file property by its key name on the global Alloy.CFG object. For instance, in the sample app configuration file defines a global property named someValue that's defined for all environments and platforms, and for individual platforms.

apps/config.json

The main XML view contains a <Button/> element whose click handler displays the value of Alloy.CFG.someValue, whose value depends on the runtime platform.

app/controllers/index.js

See Also

  • No labels