Skip to end of metadata
Go to start of metadata

Demonstrates how an Alloy controller can inherit functionality from another controller.

App folder location

Icon

alloy/test/apps/advanced/inheritance

The parent controller exports its inheritable properties or methods on its exports  property. To inherit the parent's functionality, the child controller assigns the base name of parent controller to its exports.baseController property. For example, in the sample application t he controllers/baseDialog.js file defines the dialog's common functionality, including two methods named openDialog() and closeDialog().

app/controllers/baseDialog.js

The child controller, defined by controllers/animatedDialog.js, inherits from baseController.js and overrides the parent's openDialog() function with a version that animates the dialog window's opacity as it opens.