Nisha Patel
Problem
I have fixed the issue in my angular application - Can't bind to 'formGroup' since it isn't a known property of 'form' - by adding import import { AddEditModule } from './add.edit.module'; to my component.
It works well but I have never seen anybody importing the component's own module inside the component. Can someone help me understand if it is the right fix or rather merely a patch to the issue, please?
My Module:
and My component:
Solution
You should never be importing the module into your component.
Your AutoGeneratorModule looks correct however:
Ensure in your auto-generator.component.ts you are correctly assigning a variable like: myForm!: FormGroup or myForm!: UntypedFormGroup
Also ensure in your auto-generator.component.html file you are correctly binging myForm to [formGroup]="myForm"
Make sure your AutoGeneratorModule is correctly imported in your root module
An example would look like:
Suggested blogs:
>What is the Idiomatic way to write a Typescript function with casting
>Why Redux-toolkit payload don't reconigze type in TypeScript?
>TypeScript: Define a type that refers type parameter from another line?
>Solve return type on TypeScript with boolean check doesn't seem to work
>How to fix TS2551: Property toSpliced does not exist on type Array
>Making an argument required if generic interface as no properties
>How to make argument required if generic interface as no properties?
>Cause a type error when a function returns any in TypeScript?
>Library isn’t work in Nestjs useGlobalFilters with library in TypeScript
>How to get the last cell with data for a given column in TypeScript?
>Ignore requests by interceptors based on request content in TypeScript?
>Create data with Typescript Sequelize model without passing in an id?
>How to delete duplicate names from Array in Typescript?