我希望能够在运行时创建 AngularJS 模块,所以我这样做:
<section class="panel portlet-item" id="crashpanel"></section>
<script type="text/javascript">
var angularApp = angular.module("Crashpanel", []);
angularApp.controller("CrashpanelCtrl", function ($scope, $http, $compile)
{
console.log("Hello");
});
angular.bootstrap(angular.element("#crashpanel"), [ "Crashpanel" ]);
</script>
但是没有显示“Hello”,因为控制器没有附加到元素上。如何能够将控制器附加到元素?