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
3 answers

Why dont we add 'ngModule' in decorator array of app.module.ts

I am making an angular project and have made required components and imported modules too. The main issue I see here ... is that we make 2 steps: Add component, services, pipes, modules to the top adding respective files or folder locations Add…
Deadpool
  • 7,811
  • 9
  • 44
  • 88
0
votes
1 answer

Angular2+ nested module route params empty

My app hierarchy is as follows: app(root) Modules (module) Master Detail Nav Create/home (component) Fields (module) Detail (component) Master (component) modules-routing.module.ts const routes: Routes = [ { path:…
npabs18
  • 167
  • 2
  • 10
0
votes
1 answer

Exporting declarables seems not necessary in Angular

From the Angular NgModule FAQ that talks about exporting declarables, it says that "If you don't export a declarable class, it stays private, visible only to other components declared in this NgModule", but this seems not correct. Because from…
Bohao LI
  • 2,123
  • 2
  • 18
  • 24
0
votes
1 answer

Ionic based on Angular project not found component factory

The errror: Error: No component factory found for LangPopComponent. Did you add it to @NgModule.entryComponents? My app.module.ts: @NgModule({ declarations: [ // ], imports: [ // ComponentsModule, // ], bootstrap:…
Izio
  • 378
  • 6
  • 15
0
votes
0 answers

How can we configure values in dependent angular module from depending module

I have a CoreModule (which provides common functionalities like providing customised wrapper service on top of HttpClient etc. - as npm package), and AppModule (Angular application which installs CoreModule as npm package). CoreModule has many…
Paritosh
  • 11,144
  • 5
  • 56
  • 74
0
votes
1 answer

How to lazy load module in lazy loaded module in angular?

It's an angular modules question. I have a few modules exported as npm-packages, and I need both of them for my application. let's call them Inner and Outer modules. In application I've configuration for Inner, and use it's InnerModuleService. In…
manar_mk
  • 36
  • 3
0
votes
1 answer

Whats can be the difference of a service injected at the component level vs root level?

I'm developing a project on Angular5 and I always see that the providers of any service are declared on the ngModule section and I run out with the Augury debugger and checking the Injector Graph all the dependencies are coming from root. There is…
Nestor
  • 664
  • 11
  • 25
0
votes
1 answer

Angular pass and override context in component hierarchy

I'm trying to make a hierarchy of components. There's a global "CONTEXT" object (provided at NgModule level), but I want one component to be able to override this object for their children. The "CONTEXT" object is currently obtained by injection,…
0
votes
0 answers

Angular Feature module with Routing as npm dependency

I have packaged an angular feature module with routing details as npm dependency and uploaded to my git. I am trying to add this dependency to another application and lazy load the module. This results in below error, ERROR in…
Raja
  • 627
  • 1
  • 9
  • 24
0
votes
0 answers

ionic/angular 2 receive a list of declared modules

Tell me please, how to receive a list all classes, which was declared in @NgModule. Which modules I have in @NgModule: @NgModule({ declarations: [MyApp, AuthPage, HomePage] }) And example of I want to receive: export class AppModule { …
Yegor
  • 1,088
  • 1
  • 10
  • 14
0
votes
1 answer

Get Elements, variables from other component through Double @NgModule Angular2

I'd like to get a value of variable element, _dataTable from component datatable.component.ts (from render() function) to create a new event for new button by element.on. Or create a new function inside this component. I've a problem how to get to…
DejwitK
  • 55
  • 9
0
votes
1 answer

Reusing the same NgModule with different config

I want to build a generic module that I can pass some config to customize it. For example, in the root module I want to have something like @NgModule({ imports: [ moduleFactory(config1), moduleFactory(config2), …
csbenjamin
  • 356
  • 2
  • 8
0
votes
2 answers

No NgModule metadata found for 'AppModule' in Angular4 i am not able to find the reason its showing in main.ts

Here is my package.json file , i have doubt on version of type script and angular cli , some results are also saying yarn issue . { "name": "suntistfrontend", "version": "0.0.0", "license": "MIT", "scripts": { "ng": "ng", "start":…
0
votes
0 answers

angular 2 - multiple but optional apps on one site

I have a scenario where I need multiple apps on one single page but they have to be optional. So I have 3 root-tags: , and but they will not always be all there, e.g. main-root could be missing on one page. So I created 3 NgModules: @NgModule({ …
Felix
  • 43
  • 6
0
votes
1 answer

Component of CustomModule ignores toplevel declaration in AppModule

After a long search on this pages, I am still lost. I have an AppModule and an ModalModule. AppModule is importing ModalModule AppModule declares LoaderComponent with this decorator attributes: selector: 'my-loader', template:…
weihs.th
  • 49
  • 5