A module constructed by Modular.module
is collection of components and controllers. You can register a component class or a controller class into a module then you can use your component in template. An example for registering component class and usage:
var myModule = UIExtension.modular.module('my-module', []);
var MyComponent = PDFViewCtrl.shared.createClass({
createDOMElement: function() {
return document.createElement('div');
}
}, UIExtension.Component,{
getName: function() {
return 'my-component'
}
});
myModule.registerComponent(MyComponent);
fragments: [{
target: 'home-tab-group-hand',
action: UIExtension.UIConsts.FRAGMENT_ACTION.APPEND,
template: '<my-module:my-component></my-module:my-component>'
}]
})
Example for registering controller class and usage:
var myModule = UIExtension.modular.module('my-module', []);
var MyController = PDFViewCtrl.shared.createClass({
console.info('button click');
}
}, UIExtension.Controller, {
getName: function() {
return 'MyController'
}
});
myModule.registerController(MyController);
fragments: [{
target: 'home-tab-group-hand',
action: UIExtension.UIConsts.FRAGMENT_ACTION.APPEND,
template: '<xbutton @controller="my-module:MyController"></xbutton>'
}]
})
- See also
- Modular::module