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

You can try this using loadChildren where the homeModule, productModule, aboutModule have their own route rules. const routes: Routes = [ { path: ‘home’, loadChildren: ‘app/areas/home/home.module#homeModule’ }, { path: ‘product’, loadChildren: ‘app/areas/product/product.module#ProductModule’ }, { path: ‘drawing’, loadChildren: ‘app/areas/about/about.module#AboutModule’ } ]; export const appRouting = RouterModule.forRoot(routes); and the home route rules will be like export const … Read more

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

As per the final version of Angular 2, services provided by a module are available to every other module that imports it. The Official Style Guide advice that application-wide services (singletons) that are to be reused anywhere in the application should be provided by some Core Module, that is to be imported in the main … Read more

How to declare a directive globally for all modules?

According @CrazyMac’s comment, a good way would be to create a DirectivesModule. Inside this module you can declare and import all your directives then you will be able to import this module anywhere you want. app/modules/directives/directives.module.ts import { NgModule } from ‘@angular/core’; import { HighlightDirective } from ‘./highlight.directive’; @NgModule({ imports: [], declarations: [HighlightDirective], exports: [HighlightDirective] … Read more

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

Okay, after fiddling around with this for the better part of the weekend I got it running on my end. What worked for me in the end was to do the following: Export all Routes for every module you want to route. Do not import any of the RouterModule.forChild() in the child modules. Export every … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)