首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将角度动态组件附加到tippy js内容

将角度动态组件附加到tippy js内容
EN

Stack Overflow用户
提问于 2020-04-03 16:07:10
回答 1查看 392关注 0票数 2

我正在使用带有tippy js的angular中的fullcalendar(v3)事件渲染,那么如何在fullcalendar(v3)事件渲染中将angular动态组件附加到tippy js内容中呢?

代码语言:javascript
复制
    const eventRender = function (event: IEvent, view) {
        if (event.info) {
            const factory = this._resolver.resolveComponentFactory(EventViewComponent);
            let ref;
            if (event.rendering === 'background') {
                ref = factory.create(this._injector, [], view.get(0));
            } else {
                ref = factory.create(this._injector, [], view.children('.fc-content').get(0));
            }
            ref.instance.eventInfo = event.info;
            this.dynamicComponent.push(ref);
            this._app.attachView(ref.hostView);
        }

此外,我还创建了动态组件,并附加到事件渲染到完整日历

EN

回答 1

Stack Overflow用户

发布于 2020-08-21 17:38:36

html:

代码语言:javascript
复制
<div #tippyTemplate>
    <h4>Caption</h4>
    <p>Some content</p>
</div>

ts:

代码语言:javascript
复制
@ViewChild("tippyTemplate", { read: ElementRef, static: false }) tippyTemplate: ElementRef;
...
const template = this.tippyTemplate.nativeElement;

tippy(info.el, {
   content: template,
   allowHTML: true,
   hideOnClick: "toggle",
   placement: "top",
   trigger: "click",
});
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61007520

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档