Я построил два компонента: регистрация и форма регистрации .
.
После заполнения формы и нажатия кнопки «Отправить» я получаю:

Я просмотрел все вопросы с похожей проблемой, и ни один из них не помог мне исправить блокиратор.
Registration.component.html имеет компонент формы регистрации:
(...)
<app-signup-form></app-signup-form>
(...)
Регистрация-form.component.html
<code><form [formGroup]="mysignup">
<div class="form-group">
Name:<br>
<input type="text" formControlName="name" ngModel="name" required/>
</div>
<div class="form-group">
Email:<br>
<input type="email" formControlName="email" ngModel="email" required/>
</div>
<div class="form-group">
Password:<br>
<input type="password" formControlName="password" ngModel="password" required/>
</div>
<div class="form-group">
<input type="button" value="Submit" class="btn btn-primary" (click)="signupUser()" />
</div>
<br><br>
<pre>{{mysignup.value | json}}
Signup-form.component.ts
import { Component, OnInit } from '@angular/core';
import { FormBuilder, Validators } from '@angular/forms';
import { FormGroup, FormControl } from '@angular/forms';
import { ReactiveFormsModule } from '@angular/forms'; // Linking the form model to the form template
import { HttpClient, HttpResponse } from '@angular/common/http';
@Component({
selector: 'app-signup-form',
templateUrl: './signup-form.component.html',
styleUrls: ['./signup-form.component.scss']
})
export class SignupFormComponent implements OnInit {
mysignup: FormGroup;
constructor() {}
ngOnInit() {
this.mysignup = new FormGroup({
name: new FormControl('', Validators.required),
email: new FormControl('', Validators.required),
password: new FormControl('', Validators.required)
});
}
signupUser($scope, $http) {
this.mysignup = new FormGroup({
name: new FormControl('', Validators.required),
email: new FormControl('', Validators.required),
password: new FormControl('', Validators.required)
});
// tslint:disable-next-line:no-debugger
// debugger;
$http.post('test.php', {
'name': $scope.name,
'email': $scope.email,
'password': $scope.mysignup.password
}).then(function(Response) {
console.log('Data inserted successfully');
}, function(error) {
alert('Sorry! Data couldnt be inserted!');
console.error(error);
});
}
}
Я просто хочу, чтобы данные поступили test.php
, потому что оттуда я знаю, как обращаться с этим.
Как это исправить?