wenn ich versuche, meine eckige App in lokalen starten ich habe th Fehler "Fehler FormBuilder ist kein NgModule", habe ich alles versucht, was ich tun kann, npm installieren, überprüfen Sie mein Paket JSON , alle Dinge, die mein Problem lösen können, Können Sie mir bitte helfen oder haben Sie eine Lösung?Fehler FormBuilder ist kein NgModule wenn Build
Dies ist meine Komponente:
import { Component } from '@angular/core';
import { FormGroup, Validators, NgForm, FormBuilder } from '@angular/forms';
import { Router } from '@angular/router';
import { AuthentificationService } from './authentification.service';
@Component({
selector: 'app-authentification',
templateUrl: './authentification.component.html',
styleUrls: ['./authentification.component.css']
})
export class AuthentificationComponent {
loginForm: FormGroup;
error: string = '';
constructor(
private formBuilder: FormBuilder,
private authentificationService: AuthentificationService,
private router: Router
) {
this.loginForm = formBuilder.group({
'oxylaneId': ['', Validators.required],
'password': ['', Validators.required]
});
}
onSubmit() {
this.authentificationService
.authenticate(this.loginForm.value)
.subscribe(
data => {
localStorage.setItem('id_token', data.token);
this.router.navigate(['email']);
},
error => this.error = error.message
);
}
loginUser(form: NgForm) {
console.log(form.value);
}
onChange(deviceValue) {
console.log(deviceValue);
}
}
Und mein app.module mit all meiner Modul- und Komponenten
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { FormsModule, FormBuilder, FormGroup, Validators } from '@angular/forms';
import { EmailcomponentComponent } from './emailcomponent/emailcomponent.component';
import { ColorcomponentComponent } from './colorcomponent/colorcomponent.component';
import { DesigncomponentComponent } from './designcomponent/designcomponent.component';
import { AppRoutingModule } from './app-routing.module';
import { TopBarComponent } from './top-bar/top-bar.component';
import { AuthentificationComponent } from './authentification/authentification.component';
@NgModule({
imports: [
BrowserModule,
FormsModule,
AppRoutingModule,
FormBuilder,
FormGroup,
Validators,
],
declarations: [
AppComponent,
EmailcomponentComponent,
ColorcomponentComponent,
DesigncomponentComponent,
TopBarComponent,
AuthentificationComponent,
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Vielen Dank für diese Antwort, es ist Arbeit :) –
Froh, dass es geholfen hat. Vergessen Sie nicht, als Antwort zu markieren – DAG