Я только что улучшил функцию, написанную Jussi-Kosunen, так что все вещи могут быть выполнены с помощью одного вызова.
function registerController(moduleName, controllerName, template, container) {
// Load html file with content that uses Ctrl controller
$(template).appendTo(container);
// Here I cannot get the controller function directly so I
// need to loop through the module's _invokeQueue to get it
var queue = angular.module(moduleName)._invokeQueue;
for(var i=0;i
Таким образом вы можете программно загрузить ваш шаблон из любого места и инстанцировать контроллеры, даже вложенные.
Вот рабочий пример загрузки контроллера внутри другого: http://plnkr.co/edit/x3G38bi7iqtXKSDE09pN