I have an old AngularJS app (using version 1.2) and I am trying to organize my code into JavaScript modules. However, I am struggling to figure out how to define the controller as a function within the module. In other words, I want to transition from:
<script>
function Controller($scope){
// do stuff
}
</script>
<div ng-app ng-controller="Controller"></div>
to something more like this:
<script type="module">
export function Controller($scope){
// do stuff
}
</script>
<div ng-app ng-controller="Controller"></div>
Unfortunately, I cannot seem to figure out how to achieve this. While I don't necessarily need the top-level function to be within a module, I would like to be able to call functions from modules within it. This seems to imply that it also needs to be a module. Is there a way to make this possible?