Avatar ·

خطأ: Can't bind to 'formControl' since it isn't a known property of 'input' في Angular Material

مرحباً بالجميع! أنا مبتدئ في Angular و TypeScript، وقد واجهت مشكلة عند محاولة استخدام الإكمال التلقائي من Angular Material. لقد أنشأت مكوناً مع حقل إدخال وأريد ربط `formControl` به لإدارة حالة النموذج. إليك الكود الخاص بي: **app.component.ts:** ```typescript import { Component, OnInit } from '@angular/core'; import { FormControl } from '@angular/forms'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent implements OnInit { myControl = new FormControl(''); options: string[] = ['One', 'Two', 'Three']; ngOnInit() {} } ``` **app.component.html:** ```html {{ option }}