Angular 无法将数据发送到后端
我只想将数据发送到后端以注册用户 register.component.ts 从“@angular/core”导入{Component,OnInit}; 从'@angular/forms'导入{FormBuilder,Validators}; 从“./register.service”导入{RegisterService}; @组成部分{ 选择器:“应用程序寄存器”, templateUrl:“./register.component.html”, 样式URL:['./register.component.sass'] } 导出类RegisterComponent实现OnInit{ registerFormGroup=this.fb.group{ 电子邮件:[,Validators.email], 密码:[,Validators.pattern'^?=.[A-Z]?=.[A-Z]?=.[0-9]?=.*?[?!@$%^&*-]。{8,}$'] }; 构造函数私有fb:FormBuilder,私有registerService:registerService{} 恩戈尼特{ this.RegisterPerformGroup.valueChanges.subscribeinputFields=>{ console.logthis.registerFormGroup.value; }; } //提交表格 私人委托{ //有一些错误 如果this.registerFormGroup.status==“无效”{ this.registerFormGroup.markAllAsTouched; }否则{ console.log'Ready to send';//可以了! //没有错误。让我们注册用户 this.registerService.registerthis.RegisterPerformGroup.value; } } } register.service.ts 从“@angular/core”导入{Injectable}; 从'@angular/common/http'导入{HttpClient}; @注射的{ providedIn:'根' } 导出类注册服务{ 构造函数私有http:HttpClient{} /** *@description注册用户 *@param data JSON,包括电子邮件和密码 */ 公共注册数据{ 返回此.http.post'/register'数据; } } 使用this.registerService.registerthis.RegisterPerformGroup.value;我尝试将数据发送到后端,但由于某些原因,我的服务器没有收到请求。我做错了什么?你可能应该这样做 this.registerService.registerthis.RegisterPerformGroup.value .SubscriberResponse=>{ ... };Angular 无法将数据发送到后端,angular,typescript,Angular,Typescript,我只想将数据发送到后端以注册用户 register.component.ts 从“@angular/core”导入{Component,OnInit}; 从'@angular/forms'导入{FormBuilder,Validators}; 从“./register.service”导入{RegisterService}; @组成部分{ 选择器:“应用程序寄存器”, templateUrl:“./register.component.html”, 样式URL:['./register.comp
是的,这就解决了。非常感谢。