新的离子2想知道什么是post方法,在哪里使用,在哪里写代码???
以下是示例代码
//ts code
constructor(public formBuilder: FormBuilder,
) {
this.signupForm = formBuilder.group({
firstName: ['', Validators.compose([Validators.maxLength(20), Validators.pattern('[a-zA-Z ]*'), Validators.required])]
});
//html code
<form [formGroup]="signupForm">
<ion-item>
<ion-label floating>FIRST NAME</ion-label>
<ion-input formControlName="firstName" type="text"></ion-input>
</ion-item>
</form>
-- want to post the signupForm!!
答案 0 :(得分:1)
好吧,让我们简单介绍一下post方法的基本理解。
import { Http } from '@angular/http'; import { Observable } from 'rxjs';
然后
doPost(someData: any): Observable<any> {
this.http.post('auth/login').map(response => {
return response.json();
});
}
然后用
来调用它 doPost(myData).subscribe(response => console.log(response));