Android 使用nativescript输入submit empty
我想注册用户,但我的输入值为空: 我一步一步地遵循这一点。我看不出我的代码有任何问题。有什么想法吗 Component.htmlAndroid 使用nativescript输入submit empty,android,typescript,mobile,input,nativescript,Android,Typescript,Mobile,Input,Nativescript,我想注册用户,但我的输入值为空: 我一步一步地遵循这一点。我看不出我的代码有任何问题。有什么想法吗 Component.html <GridLayout backgroundColor="#CCCCCC"> <ScrollView> <StackLayout margin="10" verticalAlignment="center"> <StackLayout class="fo
<GridLayout backgroundColor="#CCCCCC">
<ScrollView>
<StackLayout margin="10" verticalAlignment="center">
<StackLayout class="form" padding="15" backgroundColor="#FFFFFF">
<StackLayout class="input-field">
<Label text="First Name" class="label font-weight-bold m-b-5"></Label>
<TextField class="input" value="input.firstname"></TextField>
<StackLayout class="hr-light"></StackLayout>
</StackLayout>
<StackLayout class="input-field">
<Label text="Last Name" class="label font-weight-bold m-b-5"></Label>
<TextField class="input" [(ngModel)]="input.lastname"></TextField>
<StackLayout class="hr-light"></StackLayout>
</StackLayout>
<StackLayout class="input-field">
<Label text="Email" class="label font-weight-bold m-b-5"></Label>
<TextField class="input" [(ngModel)]="input.email"></TextField>
<StackLayout class="hr-light"></StackLayout>
</StackLayout>
<StackLayout class="input-field">
<Label text="Password" class="label font-weight-bold m-b-5"></Label>
<TextField secure="true" [(ngModel)]="input.password" class="input" required></TextField>
<StackLayout class="hr-light"></StackLayout>
</StackLayout>
<Button class="btn btn-primary w-full" text="Register" (tap)="register()"></Button>
</StackLayout>
</StackLayout>
</ScrollView>
</GridLayout>
我不明白为什么我的值是空的!!您能问我一些想法吗?若要在相关模块中导入
NativeScriptFormsModule
,请启用双向绑定检查。如果应用程序未使用延迟加载,则应将其作为主app.module.ts
// Uncomment and add to NgModule imports if you need to use two-way binding
import { NativeScriptFormsModule } from "nativescript-angular/forms";
imports: [
NativeScriptFormsModule // ADD it to imports
],
请注意,您共享的代码只是在应用程序设置中保存了一个键值,以后您应该重新使用该键值登录用户(通过访问特定的键
帐户缺少firstname的模型)
// Uncomment and add to NgModule imports if you need to use two-way binding
import { NativeScriptFormsModule } from "nativescript-angular/forms";
imports: [
NativeScriptFormsModule // ADD it to imports
],