bekommt Dies ist meine Client-Seite:Ionic2: Eingabefeld, warum Im leeren String in Wert
<ion-card *ngFor="#p of posts | async">
<ion-card-header>
{{p.title}}
</ion-card-header>
<ion-card-content>
<form [ngFormModel] = 'form' (ngSubmit) = 'addcomment(form.value, p.$key)'>
<ion-input type="text" placeholder="your comment" (ngModel) = 'comment'></ion-input>
<button>add comment</button>
</form>
</ion-card-content>
</ion-card>
Und in .ts:
this.form = fb.group({
'comment': ['', Validators.required]
});
this.comment = this.form.controls['comment']
Wenn ich die form.value
innerhalb addcomment()
in der Konsole aus
Control {asyncValidator: null, _pristine: true, _touched: false, _value: "", _errors: Object…}
und this.comment
(AbstractControl
Art von Variable innerhalb der Klasse) leer ist .
Warum muss "console.log (form.value)" von addcomment (form.value) – blackHawk
Sie undefiniert sein muss die 'ngFormModel' Direktive nutzen. In deinem Fall mischst du die Inline-Formulardefinition und die explizite mit 'FormBuilder' ... –
@Tiery Templier Ich brauche deine Hilfe wirklich auf dieser http://stackoverflow.com/questions/37058817/what-is-the-language -ionic-2-is-built-on und http://stackoverflow.com/questions/37027055/how-to-ache-look-and-feel-of-ionic2-css-in-angular2 – blackHawk