Business Console 10.7 | webMethods Business Console Documentation | Developing Gadgets for Business Console | Programming Gadgets | Including Independent AngularJS Modules in Gadgets
 
Including Independent AngularJS Modules in Gadgets
All business console gadgets are defined as independent AngularJS modules.
To customise designs for services, factories, and directories in gadgets as independent modules, do the following:
1. Define services, factories, and directives as independent modules in custom.js.
2. Set the dependency for the independent modules.
For example, in custom.js, define a directive as a module.
angular.module("MY_GADGET_DIRECTIVE_MODULE", []).directive("myDirective",
function(){
// ADD DIRECTIVE CODE HERE
})
The myDirective directive above is defined in an independent MY_GADGET_DIRECTIVE_MODULE module.
3. To use myDirective directive in your gadget or in any other gadget, in the gadget-definition.xml file, set the dependency of the gadget to MY_GADGET_DIRECTIVE_MODULE. The dependency of the gadget is shown below.
var myGadget = angular.module('myGadget-<ID>', ['adf.provider',
'MY_GADGET_DIRECTIVE_MODULE'])
This makes the gadget dependent on the MY_GADGET_DIRECTIVE_MODULE module, and the gadget will be able to use all the services, factories, and directives from the new module.
4. If third party AngularJS libraries are used:
*Save the library js files under the script directory of your gadget.
*Include modules in your gadget by editing gadget definition file.
*Specify modules as per Dependencies section.