PDA

View Full Version : Is there a way for loading a controller dynamically when needed to use?



wypwgx
20 Dec 2011, 4:25 AM
Usually, the single-page application may load one function module into a tab page. The way I want ,load the current controller dynamically when the module loaded and dispose the controller when the tab page be disposed.

the document says:"Controllers are the glue that binds an application together."
Does it means,I must load all controllers when the single-page application boot?

if so, to a more complex application, is it an efficient way ?

mitchellsimoens
20 Dec 2011, 5:24 AM
You can use Ext.create or requires somewhere and execute the init yourself and they may load dynamically. The problem lies when you do the build using SDK Tools that all your JS will be included as one JS file so you won't be dynamically loading them at that point so why go through the trouble of executing init yourself and such in the first place.