In every component I have to import this CommonModule to use directives like NgIf and so on.
I want a way of injecting this module in all my modules.
@Component({
selector: 'app-register',
standalone: true,
imports: [ReactiveFormsModule, CommonModule, TextInputComponent],
templateUrl: './register.component.html',
styleUrl: './register.component.scss'
})
you need to specify modules in imports, that can't be avoided to resolve services and other dependencies.
you can use this common approach
create a shared module file and Add -"imports and exports" common module / some forms module in that (the one's that is being used in all / most of them ) , and then import that sharedModule in your component file. it will reduce no. of imports line in you standalone component.