我想使用有角度6的警报器,并希望将角度分量嵌入到警报体中。
示例代码:
import * as _alertify from 'alertifyjs';
_alertify.alert('Title' , '<app-custom-component></app-custom-component>');或
_alertify.alert('My Title', '<dx-data-grid ...>...</dx-data-grid>');如何将角度分量嵌入到警报do中?或者,我能做吗?
谢谢。
发布于 2018-10-27 06:57:22
不能将整个组件作为正文内容传递。根据alertifyjs文档,它支持标题和正文内容作为字符串。这样你就可以通过component.elementref.nativeElement.innerHTML。
模板:
<app-custom-component #customcomp></app-custom-component>组件:
@ViewChild('customcomp') customcomp : ElementRef;
ngAfterViewInit(){
_alertify.alert('Title' , this.customcomp.nativeElement.innerHTML);
}https://stackoverflow.com/questions/53019337
复制相似问题