Questions tagged [ng-modules]

Angular NgModule is a class marked by the @NgModule decorator.

NgModules configure the injector and the compiler and help organize related things together.

An NgModule is a class marked by the @NgModule decorator. @NgModule takes a metadata object that describes how to compile a component's template and how to create an injector at runtime. It identifies the module's own components, directives, and pipes, making some of them public, through the exports property, so that external components can use them. @NgModule can also add service providers to the application dependency injectors.

Resources

218 questions
0
votes
1 answer

How to call Method where Constructor has httpclient in @NgModule?

I am currently using Transloco to do translation in my application. I have the below @NgModule. @NgModule({ exports: [TranslocoModule], providers: [ { provide: TRANSLOCO_CONFIG, useValue: translocoConfig({ availableLangs:…
0
votes
3 answers

How can I configure Angular to provide MyMonad when injection of MyService dependency is requested in a constructor?

I have '@typescript-eslint/prefer-readonly-parameter-types': error set in my eslintrc file for my Angular project. To make this rule more easily enforceable, I have a DeepReadonly monadic type defined to wrap objects to make them readonly. Now,…
0
votes
0 answers

What's the reccommended way to provide types in an Angular shared module?

I have a SharedModule where I have a PhoneInputComponent that you can bind a custom interface to it: export interface PhoneNumber { prefix: string; value: string; } I currently have a models/ folder inside my SharedModule directory and there…
Some random IT boy
  • 7,569
  • 2
  • 21
  • 47
0
votes
1 answer

Cannot import '@angular/core/src/metadata/ng_module' on Angular 12

I am currently trying to create a Login Page using Angular 12, and following up, I cannot import the ModuleWithProviders from @angular/core/src/metadata/ng_module. Can you please help me? I searched on the internet but found no solution, or the…
Iulia
  • 1
  • 1
0
votes
0 answers

why can there be a service in the module constructor undefined?

I have a singleton module that has a forRoot method that returns a ModuleWithProviders object in which a service is specified in the providers array that is used in the constructor of the same module. The module and the service are exported by the…
Art
  • 35
  • 4
0
votes
0 answers

Error while upgrading Angular material to v9 : ERROR in Cannot resolve type entity ɵngcc3.MatCardModule to symbol

While upgrading to angular v9 following the angular update guide, updated angular core, cli and primeng to v9; but after migrating angular material to v9, it automatically deeply imports modules for all required components and other .ts files but…
0
votes
1 answer

WARNING in Circular dependency detected: || Cannot determine the module

When building our project we get an error: fail: Microsoft.AspNetCore.SpaServices[0] WARNING in Circular dependency detected: fail: Microsoft.AspNetCore.SpaServices[0] src\app\app.module.ts -> src\main.ts ->…
Derek S
  • 47
  • 1
  • 11
0
votes
1 answer

Problems to redirect to auth route Angular

im starting to work with Angular, and im trying to create a simple route guard, to redirect user to login page, if my service return unauthorized. To do that i created this route schema -> const routes: Routes = [ { path: '', component:…
Flávio Costa
  • 895
  • 5
  • 18
  • 41
0
votes
1 answer

Failed to export .guard to another lib Angular

im trying to use a Router Guard from shared lib into app routing module (at app level). i created this RouterGuard (route.guard.ts): @Injectable({ providedIn: 'root' }) export class RouteGuard implements CanActivate { constructor(private…
Flávio Costa
  • 895
  • 5
  • 18
  • 41
0
votes
1 answer

failed to import angular external lib

i have 2 libs. 1 - ui-templates 2 - ui-components To import ui-templates from app, im doing that: import {UiTemplatesModule} from '@growerdiaries-web/ui-templates'; import { AppComponent } from './app.component'; @NgModule({ declarations:…
Flávio Costa
  • 895
  • 5
  • 18
  • 41
0
votes
0 answers

Error: Type FlatpickrModule does not have 'ngModuleDef' property

Yesterday when I finished working on my app everything work correctly. Today I'm back and I have such error: main.ts:12 Error: Type FlatpickrModule does not have 'ngModuleDef' property. at getNgModuleDef (core.js:3872) at…
0
votes
1 answer

Angular modules for admin/user scenario

I'm designing an Angular application which has admin and basic user view of every major feature. Let's say I have two features - Users and Products, where each User can have none or many Products. Each User can create, view and manage their own…
dzenesiz
  • 1,388
  • 4
  • 27
  • 58
0
votes
0 answers

Importing Angular Component Lib Module in every NgModule

In a project, we are using our clients web components that were converted to Angular components. Right now every time we need to use a single component we have to import the entire module containing every component. Does Angular optimize imports or…
t-MURO
  • 642
  • 5
  • 10
0
votes
1 answer

Can a defined provider that is a fat arrow method call another provided fat arrow method?

Lets say i have 2 fat arrow methods defined in the providers array of @NgModule. They are called capitalize and capitalizeCallingMethod. @NgModule({ providers: [ { provide: 'capitalize', useValue: (stringToCapitalize : string) => { …
Maurice
  • 6,698
  • 9
  • 47
  • 104
0
votes
1 answer

No provider for NgControl found in NodeInjector

Even though I imported FormsModule, ReactiveFormsModule in app.module.ts always I get No provider for NgControl found in NodeInjector. error home.page.html
devnc
  • 70
  • 7