JavaScript Framework fairy support js
Difference between single component and unique component

A single component will have only one instance of controller.js in the system, even if you run loadSingleComponent multiple times.
The instance of controller.js of single component will be reused from the first new one.
When data-{component name}-obj is used for view.html, if loadSingleComponent is executed multiple times, the data-{component name}-obj in the last loaded view.html will be binded to controller.js.
After a single component is loaded, it will automatically binded with controller.js when the data-{component name}-name, data-{component name}-obj, and data-{component name}-list attributes appear in the DOM on the screen.
Single components can get an instance from anywhere with $f.getComponentController('component name'). The argument is the same as the second argument of loadSingleComponent.

Unique component creates a new instance each time you run loadUniqueComponent multiple times.
After the unique component is loaded, the bind with controller.js will be updated even if the data-{component name}-name, data-{component name}-obj, data-{component name}-list attribute changes in the DOM on the screen.
Unique component cannot get an instance with $f.getComponentController('component name').


Next page Component constants

table of contents