您需要注册contorller
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 < queue.length; i++) {
var call = queue[i];
if (call[0] == "$controllerProvider" &&
call[1] == "register" &&
call[2][0] == controllerName) {
controllerProvider.register(controllerName, call[2][1]);
}
}
angular.injector(['ng', moduleName]).invoke(function ($compile, $rootScope) {
$compile($("#" + template))($rootScope);
$rootScope.$apply();
});
}后
在你的jQuery成功
registerController( '应用程序名称', '控制器', “temolatename”)
angular.element("element").scope().run();
angular.element("element").scope().$apply();
我不能使用ng-include,因为它需要确定是否加载它的逻辑。 –