Error: Can't bind to 'formControl' since it isn't a known property of 'input' in Angular Material
Hello everyone! I'm new to Angular and TypeScript, and I'm having an issue when trying to use autocomplete from Angular Material.
I created a component with an input field and want to bind `formControl` to it for form state management. Here's my code:
**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
No answers yet.
Log in to leave an answer
Blogs