2016-08-23 66 views
0

我使用nativescript-intro-slides庫構造,我跟着角例如爲mentioned但我面臨着這樣的錯誤:類型錯誤:不確定是不是(評估「新viewClass類()」)

class ListComponent - inline template:1:8 ORIGINAL EXCEPTION: 
TypeError: undefined is not a constructor (evaluating 'new viewClass()') 
ORIGINAL STACKTRACE: [email protected]:///app/tns_modules/nativescript-angular/view-util.js:90:33 

我的代碼:

import {Component,ElementRef, OnInit, ViewChild} from "@angular/core"; 
import {registerElement} from "nativescript-angular/element-registry"; 
registerElement("Slide",() => require("nativescript-intro-slides").Slide); 
registerElement("SlideContainer",() => require("nativescript-intro-slides").SlideContainer); 

@Component({ 
    moduleId: module.id, 
    selector: "List-page", 
    template: ` 
     <SlideContainer angular="true" #slides> 
      <Slide *ngFor="let img of images"> 
       <Label [text]="img.title"></Label> 
      </Slide> 
     </SlideContainer> 
    ` 
}) 

export class ListComponent implements OnInit { 
    public images: Array<any> = []; 
    @ViewChild("slides") slides: ElementRef; 
    ngOnInit() { 
     this.images.push({title: 'Sports'}); 
     this.images.push({title: 'Cats'}); 
     this.images.push({title: 'Food'}); 
    } 
    ngAfterViewInit() { 
     let SlidesXml = this.slides.nativeElement; 
     SlidesXml.constructView(); 
    } 
} 

加我找不到方法constructView。 謝謝

+0

你能告訴其中'ListComponent'稱爲父組件? –

+0

它是一個主要組件 – Elgendy

回答

0

nativescript-intro-slides圖書館有很多的問題,所以它的主人建議使用新版本nativescript-slides

enter image description here

相關問題