angularjs - 在窗口弹出窗口中打开时,ckd-overlay-container 不起作用
问题描述
我正在从 angularjs 打开 angular2 组件,因为 angularjs 一个是我的遗留应用程序,我有一个要求,我需要在窗口中显示一些新的 angular2 组件。我找到了一个解决方案,我可以使用该组件打开一个新窗口。
angular.module('myModule').factory('popupWindow', ['$rootScope', '$compile', '$window',
function ($rootScope, $compile, $window) {
var html = '<survey></survey>';
var link = $compile(html); // note that compilation happens only once
return {
open: function () {
var scope = $rootScope.$new(true);
var w = $window.open('', '_blank', 'toolbar=0,width=1250,height=600');
copyStyles(document, w.document);
// using a cloneAttachFunction, cf. the docs and http://stackoverflow.com/questions/18064543/compile-angular-on-an-element-after-angular-compilation-has-already-happened
link(scope, function (cloned, scope) {
angular.element(w.document.body).append(cloned);
});
}
};
}]);
但我现在遇到了另一个问题。该组件具有 md-autocomplete 并且当我单击它时打开 md-options 但它们与父主应用程序绑定当我查看开发人员工具时 cdk-overlay-container 附加到父应用程序而不是从它打开的子窗口。有什么解决方案吗?https://material.angularjs.org/latest/用于此。 附在此处的图片
解决方案
推荐阅读
- python - 多处理 Python 在 Windows 中不起作用
- linux - rsyslog 不打开 tcp 监听器
- visual-studio-2019 - Windows Defender 将默认 Visual Studio 2019 Windows 桌面应用程序模板的 .exe 识别为恶意
- clojure - 自动评估依赖文件(缓冲区)
- visual-studio-code - 如何在 VSCode 扩展中创建浮动窗口?
- asp.net - 如何将整个网站输出为“静态”文件(即 html、css、img)
- r - 带有 R 的 Excel 数据透视表(添加总数和百分比)而不是计数 - 包括 MRE
- mysql - 将mysql中的多条记录更新为单个查询
- instagram - Instagram API 按位置地理标签获取帖子
- r - R:替换所有不等于一组值的值