TypeError: undefined is not a constructor (evaluating 'new viewClass()')
TypeError: undefined is not a constructor (evaluating 'new viewClass()')
我正在使用 nativescript-intro-slides library, I followed the angular example as mentioned 但我遇到了这个错误:
class ListComponent - inline template:1:8 ORIGINAL EXCEPTION:
TypeError: undefined is not a constructor (evaluating 'new viewClass()')
ORIGINAL STACKTRACE: createAndAttach@file:///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。
谢谢
nativescript-intro-slides
库有很多问题所以其所有者建议使用新版本 nativescript-slides
我正在使用 nativescript-intro-slides library, I followed the angular example as mentioned 但我遇到了这个错误:
class ListComponent - inline template:1:8 ORIGINAL EXCEPTION:
TypeError: undefined is not a constructor (evaluating 'new viewClass()')
ORIGINAL STACKTRACE: createAndAttach@file:///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。 谢谢
nativescript-intro-slides
库有很多问题所以其所有者建议使用新版本 nativescript-slides