Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 8: Add input field in a form with a button Error Code

Hello I need to add an input field into my form with a button. Here my code : stackblitz I got some error in my code. I got this in my browser console: Cannot find control with name: '0' and AuditsComponent.html:9 ERROR TypeError: control.registerOnChange is not a function And in my angular server : ERROR in src/app/components/audits/audits.component.ts(50,26): error TS2345: Argument of type 'any' is not assignable to parameter of type 'never'.

Thanks for contributing !

like image 329
Aymeric Avatar asked Jun 18 '26 00:06

Aymeric


1 Answers

I'm correcting your code

https://stackblitz.com/edit/angular-hfrx5u

you must install an import in app.module.ts

  1. angular material
  2. import a MatInputModule
  3. for reactive forms input ReactiveFormsModule

     import { FormsModule, ReactiveFormsModule } from '@angular/forms';
     import {MatInputModule} from '@angular/material/input';  
    
     and in NgModule
    
    imports:[ BrowserModule, FormsModule, ReactiveFormsModule, MatInputModule],
    
like image 106
Boris Adamyan Avatar answered Jun 19 '26 18:06

Boris Adamyan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!