我有一个带有 ASP.NET 应用程序的 iframe,其中包含 UpdatePanel。我开始在应用程序中使用 Angular,但由于 .NET 回发,事情没有奏效。
为了解决这个问题,我使用了这个解决方案:
with (Sys.WebForms.PageRequestManager.getInstance()) {
add_endRequest(onEndRequest); // regester to the end Request
}
function onEndRequest(sender, args) {
angular.bootstrap($('#mainDiv'), ['defaultApp']);
var rootscope = angular.element('#mainDiv').scope();
if (rootscope) {
rootscope.$apply();
}
}
而且效果很好。
问题是,当我在 ASP.NET 页面中使用另一个 ng-controller 动态加载不同的用户控件时,Angular 会抛出一个错误,指出应用程序已加载:
App Already Bootstrapped with this Element
所以问题是:如何检查应用程序是否已经引导?我可以重新加载这个模块吗?我可以从元素中删除它然后再次引导它吗?
谢谢。