[英]AngularJS Generic function that returns loaded controller
looking for a function that returns me the name of any loaded controller. 寻找一个可以返回任何已加载控制器名称的函数。 Or is there a function that i can call after everything is initialized and access all controller names and scopes ?
还是在初始化所有内容并访问所有控制器名称和作用域之后我可以调用的函数?
You can inspect an angular module's _invokeQueue to find all registered components. 您可以检查角度模块的_invokeQueue来查找所有已注册的组件。
And if a module is dependant on another, you can inspect a modules requires array. 并且,如果一个模块依赖于另一个模块,则可以检查模块是否需要阵列。
app.service('Names', function () {
return {
allInModule: function () {
return _.map(app._invokeQueue, function (inv) {
return {
type: inv[1],
name: inv[2][0]
};
});
}
};
});
Check out this plunker to see how it works 看看这个矮人,看看它是如何工作的
http://plnkr.co/edit/XmDF94?p=preview http://plnkr.co/edit/XmDF94?p=preview
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.