如何设置将在我要为id做的表单上预填的值

时间:2019-04-19 07:51:17

标签: android angular nativescript

我想创建一个编辑表单并发送这些值上预先填充的值,以了解如何使用nativscriptangular js

     <StackLayout margin="10" verticalAlignment="center">
    <StackLayout class="form" padding="15" backgroundColor="#FFFFFF">
        <StackLayout class="input-field">
            <Label text="Company Name" class="label font-weight-bold m-b-5"></Label>
            <TextField class="input" [(ngModel)]="input.companyname"></TextField>
            <StackLayout class="hr-light"></StackLayout>
        </StackLayout>

        <StackLayout class="input-field">
        <Label text="Phone Number" class="label font-weight-bold m-b-5"></Label>
        <TextField class="input"  keyboardType="phone"
        [(ngModel)]="input.phonenumber"></TextField>
        <StackLayout class="hr-light"></StackLayout>
        </StackLayout>

     <StackLayout class="input-field">
     <Label [text]="params.id" class="label font-weight-bold m-b-5"></Label>
     <TextField [text]="params.id" class="input" [(ngModel)]="input.id"></TextField>
     <StackLayout class="hr-light"></StackLayout>
     </StackLayout>
        <Button class="btn btn-primary w-full" text="Update" (tap)="register_update()"></Button>
    </StackLayout>
</StackLayout>

1 个答案:

答案 0 :(得分:0)

我找到的这些解决方案将参数传递给模型,并使其可见。

<TextField [(ngModel)]='model.mytext.id'></TextField>
 this.params = this.params.context;    

this.model.mytext = this.params;