Angular 오류: Angular에서 양식 컨트롤을 찾을 수 없음

이 튜토리얼에서는 Angular 애플리케이션에서 양식 컨트롤을 찾을 수 없다는 오류에 대한 해결책을 찾을 것입니다. 이제 각도에서 이름 양식 컨트롤을 찾을 수 없다는 오류 솔루션을 볼 수 있습니다. 다음과 같습니다.

먼저 @angular/forms npm 패키지에서 FormControl을 가져옵니다. 다음과 같습니다.

import { FormControl } from '@angular/forms';

@angular/forms npm 패키지에서 formcontrol을 가져오는 방법에 대한 예제를 살펴보겠습니다. 다음과 같습니다.

import { Component, OnInit } from '@angular/core';
import { FormGroup, Validators, FormControl} from '@angular/forms';
  
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit{
  title = 'my-new-app';
  
  ngOnInit() {
    this.title = "Title Updated";
  }
  
  form = new FormGroup({
    name: new FormControl('', [Validators.required, Validators.minLength(3)]),
    email: new FormControl('', [Validators.required, Validators.email]),
    body: new FormControl('', Validators.required)
  });
    
  get f(){
    return this.form.controls;
  }
    
  submit(){
    console.log(this.form.value);
  }
}

Angular 응용 프로그램에서 '오류가 양식 컨트롤을 찾을 수 없음'에 대한 해결책을 찾았고 이 오류도 수정했습니다.

1.05 GEEK