簡體   English   中英

在 swiper appendSlide() 中渲染角度組件

[英]render angular component inside swiper appendSlide()

我正在嘗試像這樣在 swiper.appendSlide 中加載我的角度組件

var swiper = new Swiper('.swiper-container', {
      pagination: {
        el: '.swiper-pagination',
        type: 'fraction',
      },
      navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
      },
    });
    swiper.appendSlide('<div class="swiper-slide">Slide 1</div>')
    swiper.appendSlide('<div class="swiper-slide"><app-Hello-Component></app-Hello-Component></div>')

它向我展示了兩張幻燈片,但第二張幻燈片是空的,並且不呈現我的組件app-Hello-Component 如果我想在 swiper-slide 中動態附加帶有角度組件的幻燈片,我該怎么辦?

只需刪除<div></div>

添加<app-Hello-Component></app-Hello-Component>而不用<div></div>包圍它

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM