1
即時製作移動應用程序。在我的登錄表單我有2周的TextFieldNativeScript ng2雙向綁定不適用於TextField
<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>
在component.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的值不會更改組件邏輯中的值。 任何想法?
ps。我已經在我的@ngModule中導入了NativescriptFormsModule
我在我的組件中導入了這個模塊仍然沒有工作:( –
爲你的模塊添加代碼 –
我不知道你在第一時間我做了Yoy說的和它的工作謝謝隊友! –