我使表格具有起息日和其他编号
当我绑定日期时,它不会绑定,并且数字已经显示,但是用不同的语言我应该重写数字
这是代码:
private initializeForm() {
let Porn = new Date();
let PornNo = 0;
let deadNo = 0;
if (this.mode == 'Edit') {
console.log(this.rabbit.Porn.toString());
if (this.rabbit.Porn != null) {
Porn = this.rabbit.Porn;
}
else
Porn = new Date();//this.rabbit.Porn;
if (this.rabbit.PornNo != null)
PornNo = parseInt(this.rabbit.PornNo.toString());
if (this.rabbit.deadNo != null)
deadNo = parseInt(this.rabbit.deadNo.toString());
}
this.rabbitForm = new FormGroup({
'Porn': new FormControl(Porn, Validators.required),
'PornNo': new FormControl(PornNo, Validators.required),
'deadNo': new FormControl(deadNo, Validators.required)
});
}
ngOnInit() {
this.mode = this.navParams.get('mode');
if (this.mode == 'Edit') {
this.rabbit = this.navParams.get('rabbit');
//this.txtPostion = this.rabbit.PositionId;
this.index = this.navParams.get('index');
}
this.initializeForm();
}
这里是风景
<form [formGroup]="rabbitForm" (ngSubmit)="onSubmit()">
<ion-list>
<ion-item>
<ion-label>Date</ion-label>
<ion-datetime displayFormat="MM/DD/YYYY" formControlName="Porn" [(ngModel)]="rabbit.Porn"></ion-datetime>
</ion-item>
<ion-item>
<ion-label floating>number babie</ion-label>
<ion-input type="number"
formControlName="PornNo" [(ngModel)]="txtPornNo"></ion-input>
</ion-item>
<ion-item>
<ion-label floating>number babie dead</ion-label>
<ion-input type="number"
formControlName="deadNo" [(ngModel)]="txtdeadNo"></ion-input>
</ion-item>
</ion-list>
<button type="submit"
ion-button
block
[disabled]="!rabbitForm.valid">
{{ mode }} Save
</button>
</form>
enter code here
我使表格具有起息日和其他编号 当我绑定日期时,它不会绑定,并且数字已经显示,但是用其他语言,我应该重写数字
答案 0 :(得分:0)
<form [formGroup]="rabbitForm" (ngSubmit)="onSubmit()">
<ion-list>
<ion-item>
<ion-label>Date</ion-label>
<ion-datetime displayFormat="MM/DD/YYYY" formControlName="Porn"></ion-datetime>
</ion-item>
<ion-item>
<ion-label floating>number babie</ion-label>
<ion-input type="number"
formControlName="PornNo"></ion-input>
</ion-item>
<ion-item>
<ion-label floating>number babie dead</ion-label>
<ion-input type="number" formControlName="deadNo" ></ion-input>
</ion-item>
</ion-list>
<button type="submit"
ion-button
block
[disabled]="!rabbitForm.valid">
{{ mode }} Save
</button>
`