Angular 1 - 获取控制器 运行 中的模块

Angular 1 - Get the module a controller is running in

我在一个平台内工作,您可以在其中使用 Web 表单创建控制器并在其中编写 angular 代码...但我无权访问父模块。

所以我在我的模块中,尝试应用过滤器,但如果我不知道该模块,我将无法应用过滤器。

有什么方法可以从控制器中找出我 运行 所在的模块吗?

我只能访问此代码:

    function ($scope, spUtil, snRecordWatcher, $rootScope) {

   }

我看不到 angular.module(blabla)

谢谢, 亚历山德鲁 S.

如果你注入$rootElement,你可以用它来找到当前控制器所在模块的名称运行。例如:

function ($scope, spUtil, snRecordWatcher, $rootScope, $rootElement) {
    var module = $rootElement.attr('ng-app');
}