Skip to content

Commit 6b79c1b

Browse files
committed
Merge branch 'master' of github.com:angular-checklist/angular-checklist into i18n-step1-content-multiple-languages
2 parents bc38586 + f27a943 commit 6b79c1b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

content/en-US/architecture/provide-shared-services-on-root-level.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Working with a shared module is quite common and recommended. This module can be
1010

1111
# Solution
1212

13-
When creating a `SharedModule`, we want to import the components in all feature modules but only only provide the services in our root module, for instance `AppModule`. We can accomplish this by leveraging the `forRoot` convention. Here's what our `SharedModule` would look like this:
13+
When creating a `SharedModule`, we want to import the components in all feature modules but only provide the services in our root module, for instance `AppModule`. We can accomplish this by leveraging the `forRoot` convention. Here's what our `SharedModule` would look like this:
1414

1515
```ts
1616
@NgModule({

content/en-US/router/lazy-load-feature-modules.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ This means that the `UsersModule` will be added to the main bundle. The main bun
4141
// app.routing.ts
4242
const routes: Routes = [
4343
...
44-
{path: 'users', loadChildren: '../users/usersModule#UserModule'}
44+
{
45+
path: 'users',
46+
loadChildren: () => import('../users/usersModule').then(m => m.UsersModule)
47+
}
4548
...
4649
];
4750

@@ -57,7 +60,8 @@ const routes: Routes = [
5760
export class AppModule {}
5861
```
5962

60-
We updated the `/users` route to use the `loadChildren` property. This points to the module file of the `UsersModule` and always has a fixed format: `${pathToModule}#${nameOfTheModule}`.
63+
We updated the `/users` route to use the `loadChildren` property. This uses the standard dynamic import syntax.
64+
Called as a function, the import returns a promise which loads the module.
6165

6266
Also note that we no longer add the `UsersModule` to the imports of the `AppModule`. This is important because otherwise lazy loading wouldn't work as expected. If the `UsersModule` was referenced by the `AppModule` the code for that module would be added to the main bundle.
6367

0 commit comments

Comments
 (0)