Questions tagged [angular2-modules]

132 questions
134
votes
9 answers

error TS1192: Module '" A.module"' has no default export

I have created a new module 'A' and trying to import it in another module called 'B'. I am getting this error on compiling that says error TS1192: Module '" A.module"' has no default export Can anyone please help on how to solve this error.
Abhi
  • 4,553
  • 4
  • 16
  • 22
120
votes
14 answers

Lazy Loading BrowserModule has already been loaded

I am trying to implement lazy loading but getting error as following ** ERROR Error: Uncaught (in promise): Error: BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module,…
70
votes
7 answers

How to route to a Module as a child of a Module - Angular 2 RC 5

I am in the process upgrading an application I'm working on to the latest Angular 2 release candidate. As part of this work I am attempting to use the NgModule spec and migrating all of the parts of my application to modules. For the most part, this…
56
votes
2 answers

How to declare a directive globally for all modules?

I'm developing a Github repo which follows the offical tutorial of Angular (Tour of Heroes). You can see all the code here. My problem, is that I have a directive declared in the main module of the app (app.module) and, if I use it inside the…
ismaestro
  • 7,561
  • 8
  • 37
  • 50
49
votes
7 answers

How to share service between two modules - @NgModule in angular not between to components?

In my application, I have two different bootstrap module (@NgModule) running independently in one application. There are not one angular app bit separate bootstrap module and now I want they should communicate to each other and share data. I know…
Aniruddha Das
  • 20,520
  • 23
  • 96
  • 132
48
votes
10 answers

Angular2 module has no exported member

For a website with authentication in Angular2, I want to use a component of the authentication submodule in the main app component. However, I keep getting the following error: app/app.component.ts(3,10): error TS2305: Module…
user2416984
  • 941
  • 1
  • 11
  • 18
36
votes
5 answers

Angular2 router: how to correctly load children modules with their own routing rules

here is my Angular2 app structure: Here is part of my code. The following is the main module of the Angular2 app, that imports its routing rules and a child module (EdgeModule) and uses some components related to some…
smartmouse
  • 13,912
  • 34
  • 100
  • 166
32
votes
5 answers

Angular: Lazy loading modules with services

I've been following this tutorial, to understand lazy loading, and below is my inference. Scenario 1: Services are provided by putting them in the providers array of a child module Scenario 2: Services are provided in a child module using the…
28
votes
1 answer

Angular2 Module: How can i import a service from another module

import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { ClinicFacilityService } from './apiClient.module'; @NgModule({ imports: [ CommonModule, …
Allan Kimaina
  • 347
  • 2
  • 4
  • 11
27
votes
1 answer

Angular2 - 'Can't resolve all parameters' error while injecting http into a custom service

I have built an ErrorHandlerLogger which is a service which extends ErrorHandler and logs error messages into a remote repository. ErrorHandlerLogger requires the Angular http client provided by the HttpModule. In the ErrorHandlerModule I import…
Picci
  • 16,775
  • 13
  • 70
  • 113
27
votes
3 answers

Unexpected value 'MyCustomModule' imported by the module 'AppModule'

I am trying to migrate one of my angular2 custom library to RC.6 + Webpack. My directory structure is: - src - source TS files - lib - transpiled JS files + definition files - dev - development app to test if it works / looks ok. - myCustomLib.js -…
Baumi
  • 1,745
  • 1
  • 17
  • 31
23
votes
7 answers

Angular 2: Module not found: Error: Can't resolve

I have a simple app created with Angular-CLI, I wanted to refactor and move the app.component.ts code in separate component file and started to get a nasty error: Module not found: Error: Can't resolve on './sb/sb.component.html' ( my…
joeCarpenter
  • 1,495
  • 4
  • 19
  • 32
22
votes
1 answer

Angular 2 difference between core and feature modules

I don't understand the difference between core and feature modules in angular 2. As far as I understand there are three recommended types of modules: core, feature and shared. If a module exports some declarations (components, directives and pipes)…
Ildar
  • 3,808
  • 7
  • 45
  • 81
17
votes
0 answers

How to dynamically load external angular 2 module (like served from an external module.bundle.js)

I can dynamically load local modules as someone else did in the plunker here. But how do I load an external module, lets say from a separate bundle js served by another service. In the example plunker, src/app.ts has: constructor(private viewref:…
AzureMinotaur
  • 646
  • 2
  • 9
  • 22
17
votes
2 answers

Can't bind to FormGroup since it isn't a known property of 'form' (FormsModule, ReactiveFormsModule loaded)

I've just seen this question but I still have the same error. I have a shared module which I import to my feature module. But I also tried import FormsModule, ReactiveFormsModule modules to my feature module directly. Angular 2.0 Final version. My…
Javier RB
  • 388
  • 1
  • 4
  • 10
1
2 3
8 9