0
WrapLayoutに子を追加できません。ここに私のchoose_time.htmlは次のとおりです。ここでNativescript。 Angular2 + Typescript。子をWrapLayoutに追加する
<WrapLayout #wrapLayout>
</WrapLayout>
は私choose_time.component.tsです:私は間違っ
import { Component, ElementRef, ViewChild } from "@angular/core";
import { WrapLayout } from 'ui/layouts/wrap-layout'
import labelModule = require("ui/label");
@Component({
selector: "choose_time",
providers: [],
templateUrl: "pages/choose_time/choose_time.html",
styleUrls: ["pages/choose_time/choose_time-common.css"]
})
export class ChooseTimeComponent implements OnInit {
@ViewChild("wrapLayout") wrapLayout: ElementRef;
constructor(
private page: Page) {}
ngOnInit() {
this.page.actionBarHidden = true;
this.setChildren()
}
setChildren(){
var label = new labelModule.Label();
label.text = "text";
this.wrapLayout.addChild(label)
}
何をしているのですか?
はい、動作します。どうもありがとう!!! –
クールで、他の人が簡単に見つけられるように答えを受け入れてください。乾杯! –