简体   繁体   English

聚类角度js Typescript中的滚动错误

[英]Clusterize scroll errors in angular js Typescript

Trying to implement the lazy loading using the Clusterize js in Angular js Typescript. 尝试使用Angular js Typescript中的Clusterize js实现延迟加载。 Unfortunately getting the errors. 不幸的是得到错误。

Any expert advice please? 有什么专家意见吗?

HTML VIEW HTML视图

<div id="scrollArea" class="clusterize-scroll">
    <ul id="contentArea" class="clusterize-content"></ul>
</div>

Angular JS 角JS

namespace Cis2.VC.OrderCreate {

angular.module("cis2")
    .directive("cis2VCOrderCreate", directiveDefinition);

templateUrl = "sections/vc/columns/vcOrderCreate/view.html";

function directiveDefinition () {
         directive = {
        "bindToController": true,
        "controller": cis2VCOrderCreateController,           
        "templateUrl": templateUrl
    };
 }

class cis2VCOrderCreateController implements Cis2.Finder.Column.IEntityCreator {    

        constructor() {    

        activate () {            
            let rows   = [];
            for(var i = 1; i < 50000; i++) {
                rows.push(i);
            }
            console.log(rows);
            var clusterize = new Clusterize({
                rows: rows,
                scrollId: 'scrollArea',
                contentId: 'contentArea'
            });
    }
}

}

Console errors 控制台错误

TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
    at Clusterize.html (http://localhost:63342/cis-ui-src/public/lib/clusterize/clusterize.js:341:26)      

You are supposed to supply markup to the rows option. 您应该为rows选项提供标记。 Numbers won't work. 数字无效。 From the documentation: 从文档中:

rows
If you render rows by yourself - pass array of tags in String. 如果您自己渲染行,请在String中传递标签数组。 This way is preferable. 这种方式是优选的。 If you need to use existing markup - do not specify this option at all. 如果您需要使用现有的标记-完全不要指定此选项。

    activate () {            
        let rows   = [];
        for(var i = 1; i < 50000; i++) {
            rows.push("<li>" + i + "</li>");  //this must be a string of markup
        }
        console.log(rows);
        var clusterize = new Clusterize({
            rows: rows,
            scrollId: 'scrollArea',
            contentId: 'contentArea'
        });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM