node.isAncestor不是函数

当我运行 npm run build:ssr 命令时,它会成功返回应用程序URL。请参见下文

Node server listening on http://localhost:4000

在浏览器中点击网址时,出现以下错误。

ERROR TypeError: node.isAncestor is not a function
    at DocumentFragment._ensureInsertValid (D:\xampp\htdocs\abc\dist\server.js:80983:14)
    at DocumentFragment.insertBefore (D:\xampp\htdocs\abc\dist\server.js:81113:12)
    at DocumentFragment.value (D:\xampp\htdocs\abc\dist\server.js:81129:17)
    at buildFragment (D:\xampp\htdocs\abc\dist\server.js:305246:26)
    at domManip (D:\xampp\htdocs\abc\dist\server.js:306281:14)
    at jQuery.fn.init.append (D:\xampp\htdocs\abc\dist\server.js:306472:10)
    at Owl.initializestage (D:\xampp\htdocs\abc\dist\server.js:382409:17)
    at Owl.initialize (D:\xampp\htdocs\abc\dist\server.js:382471:8)
    at new Owl 
cjh0971 回答:node.isAncestor不是函数

好像您使用的是owl carousel,猫头鹰使用的是jQuery,SSR不支持它,因此无法在服务器端进行渲染。

,

最近,我已经解决了这个问题。请按照以下步骤操作。

import { Component,ViewChild } from '@angular/core';
import { OwlCarousel } from 'ngx-owl-carousel';

export class HomeComponent { 

    @ViewChild('owlElement') owlElement: OwlCarousel;

    ngOnInit() {

       this.owlElement.trigger('play.owl.autoplay',[3000]);
    }

}

<owl-carousel #owlElement
       [items]="images"
       [options]="sliderOption"
       [carouselClasses]="['owl-theme','row','sliding']">

       <div class="item landing-slider-banner" *ngFor="let image of images">
           <div class="container">

           </div>
       </div>
</owl-carousel>
本文链接:https://www.f2er.com/2980304.html

大家都在问