Questions tagged [angular2-modules]
132 questions
3
votes
5 answers
How to access a component from different module in angular 2
I am new to angular 2, so please excuse me if this question sounds trivial to you. I am creating a feature module in angular 2 and I will export all the components from this module. Main module can import it and add this module in import list. By…

Pragmatic
- 3,093
- 4
- 33
- 62
3
votes
0 answers
angular 2 Import Custom Module returns error
I'm getting this error trying to import a custom module
zone.js:269 Uncaught Error: Unexpected value '[object Object]'
imported by the module 'AppModule'
this is my app.module.ts
const SELFBITSCONFIG = {...}
@NgModule({
imports: [
...
…

Han Che
- 8,239
- 19
- 70
- 116
2
votes
2 answers
@Angular 2: Better approach Whether to create components or modules
@angular2, @angular2-components, @angular2-modules
What would be better approach whether to create child modules of app module or different components for different features of project using angular2 from design and business perspective ?

Aman Prajapati
- 137
- 10
2
votes
0 answers
Discovering and Loading NgModules at Runtime
In angular 2/4, is there a way to inject modules and components discovered at runtime ?
I mean, NgModules can be loaded at runtime thanks to angular-cli/webpack but webpack needs to statically analyse all modules at compile time in order to package…

Patrice
- 1,404
- 1
- 14
- 27
2
votes
1 answer
Error in lazy load module in angular 4.x
I have implemented lazy loading module in angular 4.x application.
app.route.ts
const routes: Routes = [
{
path: '',redirectTo:'home',pathMatch:'full'
},
{
path:'home',
children:[
…

Ghanshyam Singh
- 1,361
- 2
- 15
- 27
2
votes
2 answers
How do I share the same instance of a service among all the components of a lazily loaded module?
I have a root module called "AppModule". "AppModule" lazy loads several other modules one of which is called "BooksAndRunModule". I have two components that belong to "BooksAndRunModule" that need to share the same instance of a service which I have…

FlashBanistan
- 426
- 1
- 9
- 25
2
votes
1 answer
Using vanilla js code in Angular 2 (angular-cli)
I am trying to implement the Vanilla Tilt JS plugin in my project, but I can't even seem to find a way of using vanilla js imports in my project.
So far, I have tried using it as a directive, just like you would use a jQuery plugin by using…

Tanasos
- 3,928
- 4
- 33
- 63
2
votes
0 answers
loadChildren can't find module (lazy loading modules)
I'm trying to implement lazy loading modules, but the error appears.
My proest uses System.js, maybe I'm wrong to point out the way, how is it calculated?
My app.module.ts:
import { NgModule } from '@angular/core';
imports ...
const APP_ROUTES:…

Konstantin Kudelko
- 350
- 3
- 12
2
votes
1 answer
Importing angular component to be available in all modules
I've recently started playing with angular 2 and my experience so far is awesome. I have some good experience with ng1 and React as well. So, this is more of a general question and a confusion as well. I am pretty sure this would help out a lot of…

Umair Sarfraz
- 5,284
- 4
- 22
- 38
2
votes
1 answer
Angular 2 - How passing parameters to abstract service
Angular 2 - How passing parameters to abstract service when I provide service in module
File with abstract service
@Injectable()
export class Service{
private headers: RequestOptions = headersRequest.options;
private readonly baseUrl:…

Daniel Morozov
- 315
- 2
- 11
2
votes
1 answer
Angular 2 use a module without importing it
This may sounds dumb, but I would like to know if there's a way of importing a module once, and making it available for all child modules.
For instance, I want to use MaterialModule in all my modules. Currently, I have to import it in every module,…
user4676340
2
votes
0 answers
Angular 2 routing modules interaction
I have 3 modules: SimpleCalculations, FunnyCalculations, OtherCalculations.
Each of them has routing.module.ts file, where I define their child routes and other stuff.
I want to have MainCalculation module, which child routes wold be taken from…

Sergey Tyupaev
- 1,264
- 9
- 23
2
votes
1 answer
Why do feature modules have to export common dependencies in AngularJS
I have been reading this tutorial on creating a feature module : https://johnpapa.net/introducing-angular-modules-feature-modules-2/.
In this tutorial FormsModule is imported by shared.module.ts and then exported. Why is that ?
Also why does…

mp3por
- 1,796
- 3
- 23
- 35
2
votes
1 answer
Re-export nested modules
I have an Angular 2 project with the following structure:
/app
app.component.ts
app.module.ts
/shared
shared.module.ts
/layout
/utilities
utilities.module.ts
…

Jan
- 500
- 6
- 9
2
votes
1 answer
Angular2 - How does my module import and use another module?
My component, ListingComponent, uses a component called MemberCountryFilter. I have this module and everything is working.
@NgModule({
imports: [CommonModule, RouterModule, FormsModule, ReactiveFormsModule],
declarations:…

Don Chambers
- 3,798
- 9
- 33
- 74