我有一个包含嵌套值的列表,并使用ngfor进行交互并以递归方式挂载在屏幕上
但"离子输入"项目显然已创建但在屏幕上不可见,我改变了输入离子"输入和它们出现,问题似乎是" ion-input"
quiz.html
<ion-list *ngFor="let question of questions">
<question [question]="question"></question>
</ion-list>
question.ts
import {
Component,
Input,
ChangeDetectionStrategy,
ViewEncapsulation
} from '@angular/core';
import {QuestionarioBase2} from "../../model/questionario-base2";
import {Item} from "ionic-angular";
@Component({
selector: 'question',
templateUrl: 'question.html',
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None
})
class TempItem extends Item {
static decorators = undefined;
}
export class QuestionComponent extends TempItem {
@Input() question: QuestionarioBase2;
}
question.html
<div *ngIf="question.component == 'text'">
<edicao [question]="question"></edicao>
</div>
edicao.html
<ion-item>
<ion-label color="marrom" floating><strong>{{question.text}}</strong></ion-label>
<ion-input></ion-input>
</ion-item>
<div *ngIf="question.children">
<div *ngFor="let children of question.children">
<question [question]="children"></question>
</div>
</div>
答案 0 :(得分:0)
您的<ion-input></ion-input>
没有与之关联的类型。将其更新为<ion-input type="text"></ion-input>