我想创建一个应用程序,它可以在多个模块中分配自己的路由和所有。用户可以从应用程序主模块打开和关闭这些模块。
答案 0 :(得分:1)
应为主模块提供已启用模块的列表:
// ***********************************************************************
public static class MyWebPageExtensions
{
public static string GetPostBackControlUniqueID(this Page page)
{
if (!page.IsPostBack)
return string.Empty;
Control control = null;
string controlName = page.Request.Params["__EVENTTARGET"]; //this method works only for link buttons which use javascript: __doPostBack(...) and not input type=submit buttons. Note: it is also available in Request.Form collection but this doesn't require to loop over Form.
if (!String.IsNullOrEmpty(controlName))
{
control = page.FindControl(controlName);
}
else
{
// __EVENTTARGET is null, the control is a button (not javascript linkButton), we need to iterate over the form collection to find it
foreach (string id in page.Request.Form)
{
// handle ImageButton they having an additional "quasi-property" in their Id which identifies mouse x and y coordinates
if (id.EndsWith(".x") || id.EndsWith(".y"))
{
string id2 = id.Substring(0, id.Length - 2);
control = page.FindControl(id2);
}
else
{
control = page.FindControl(id);
}
if (control is IButtonControl) break;
}
}
return control == null ? String.Empty : control.UniqueID;
}
}
显然,var enabledModules = [...];
angular.module('app', ['thirdParty', 'app.common'].concat(enabledModules));
数组不能正常加载enabledModules
,因为此时应用程序不会被引导。可以使用XHR或服务器端模板来定义它。
或者,可以使用单独的应用程序来加载先决条件。由于使用DI,可以对其进行全面测试。
$http