【发布时间】:2017-04-19 17:51:26
【问题描述】:
我正在制作一个移动应用程序。在我的登录表单中,我有 2 个文本字段
<TextField hint="Email Address" keyboardType="email" [(ngModel)]="email" autocorrect="false" autocapitalizationType="none"></TextField>
<TextField hint="Password" secure="true" [(ngModel)]="password"></TextField>
<Label [text]="email"></Label>
在组件.ts中
import { Component, OnInit } from '@angular/core';
import { Router } from "@angular/router";
import { NativeScriptRouterModule } from "nativescript-angular/router";
import { Page } from "ui/page";
import * as Toast from 'nativescript-toast';
@Component({
moduleId: module.id,
selector: 'sign-in',
templateUrl: "template.html"
})
export class SignInPage implements OnInit {
email: string ="example";
password: string;
constructor(private router: Router, page: Page) {
page.actionBarHidden = true;
}
ngOnInit() {
var loginParams = { user: { email: this.email }, password: this.password };
console.dump(loginParams);
}
}
标签显示“示例”,但 textField 没有。更改 textField 的值不会更改组件逻辑中的值。 任何想法?
ps。我已经在我的@ngModule 中导入了 NativescriptFormsModule
【问题讨论】:
标签: angular typescript nativescript angular2-forms angular2-nativescript