I want to be able to create AngularJS modules at runtime, so I do this:
<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>
But "Hello" is not displayed, because the controller is not attached to the element. How to be able to attach the controller to the element ?
You need to put the data-ng-app="Crashpanel" somewhere in your code to make a reference to your module if you want, example:
<html data-ng-app="Crashpanel">
Your section must have a ng-controller attribute(like the another user said) to make a reference to your controller.
<section class="panel portlet-item" id="crashpanel" data-ng-controller="CrashpanelCtrl"></section>