angular/packages
Alex Rickabaugh c61df39323 feat(router): deprecate loadChildren:string (#30073)
The proposed ES dynamic import() is now supported by the Angular CLI and the
larger toolchain. This renders the `loadChildren: string` API largely
redundant, as import() is far more natural, is less error-prone, and is
standards compliant. This commit deprecates the `string` form of
`loadChildren` in favor of dynamic import().

DEPRECATION:

When defining lazy-loaded route, Angular previously offered two options for
configuring the module to be loaded, both via the `loadChildren` parameter
of the route. Most Angular developers are familiar withthe `string` form of
this API. For example, the following route definition configures Angular to
load a `LazyModule` NgModule from `lazy-route/lazy.module.ts`:

```
[{
  path: 'lazy',
  loadChildren: 'lazy-route/lazy.module#LazyModule',
}]
```

This "magic string" configuration was previously necessary as there was
no dynamic module loading standard on the web. This has changed with the
pending standardization of dynamic `import()` expressions, which are now
supported in the Angular CLI and in web tooling in general. `import()`
offers a more natural and robust solution to dynamic module loading. The
above example can be rewritten to use dynamic `import()`:

```
[{
  path: 'lazy',
  loadChildren: () => import('./lazy-route/lazy.module').then(mod => mod.LazyModule),
}]
```

This form of lazy loading offers significant advantages in terms of:

* type checking via TypeScript
* simplicity of generated code
* future potential to run natively in supporting browsers
  (see: [caniuse: dynamic import()](https://caniuse.com/#feat=es6-module-dynamic-import))

As a result, Angular is deprecating the `loadChildren: string` syntax in
favor of ES dynamic `import()`. An automatic migration will run during
`ng upgrade` to convert your existing Angular code to the new syntax.

PR Close #30073
2019-04-24 17:06:05 -07:00
..
animations docs(animations): fixed some closing brackets on query animation page (#29854) (#29855) 2019-04-18 18:19:48 -07:00
bazel fix(bazel): make name param in ng add optional (#30074) 2019-04-24 10:45:42 -07:00
benchpress build: update rxjs version requirements to 6.4.0 (#30032) 2019-04-22 11:15:33 -07:00
common refactor(common): rename LocationUpgradeService and remove angular/upgrade dependency (#30055) 2019-04-24 13:49:29 -07:00
compiler fix(ivy): queries not being inherited from undecorated classes (#30015) 2019-04-24 10:38:44 -07:00
compiler-cli fix(ivy): don't reuse a ts.Program more than once in ngtsc (#30090) 2019-04-24 11:41:21 -07:00
core feat(router): deprecate loadChildren:string (#30073) 2019-04-24 17:06:05 -07:00
docs refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00
elements build: update rxjs version requirements to 6.4.0 (#30032) 2019-04-22 11:15:33 -07:00
examples docs(core): update API doc examples to use static injector (#29729) 2019-04-08 17:20:34 -07:00
forms build: update rxjs version requirements to 6.4.0 (#30032) 2019-04-22 11:15:33 -07:00
http build: update rxjs version requirements to 6.4.0 (#30032) 2019-04-22 11:15:33 -07:00
language-service fix(language-service): Use proper types instead of any (#29942) 2019-04-17 12:17:13 -07:00
platform-browser feat(common): add @angular/common/upgrade package for $location-related APIs (#30055) 2019-04-24 13:49:29 -07:00
platform-browser-dynamic refactor(ivy): prefix all generated instructions (#29692) 2019-04-10 12:11:40 -07:00
platform-server feat(common): add @angular/common/upgrade package for $location-related APIs (#30055) 2019-04-24 13:49:29 -07:00
platform-webworker feat(common): add @angular/common/upgrade package for $location-related APIs (#30055) 2019-04-24 13:49:29 -07:00
platform-webworker-dynamic build: remove now redundant bundle_dts = True attribute (#29128) 2019-03-07 10:47:20 -08:00
private/testing feat(ivy): support i18n without closure (#28689) 2019-04-11 08:28:45 -07:00
router feat(router): deprecate loadChildren:string (#30073) 2019-04-24 17:06:05 -07:00
service-worker refactor(service-worker): use Adapter#parseUrl() for all URL parsing (#27080) 2019-03-21 12:07:56 -04:00
upgrade refactor(upgrade): rename module constant to avoid webpack bug (#30058) 2019-04-24 17:03:51 -07:00
BUILD.bazel build: rules_nodejs 0.26.0 & use @npm instead of @ngdeps now that downstream angular build uses angular bundles (#28871) 2019-02-28 12:06:36 -08:00
empty.ts refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00
goog.d.ts test(ivy): add bundling test todo_i18n (#27420) 2018-12-04 19:59:12 -08:00
license-banner.txt build: bump year (#27880) 2019-01-11 11:15:59 -08:00
README.md Revert "docs: Remove unneeded file (#18106)" 2017-07-20 16:46:47 -05:00
system.d.ts refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00
tsconfig-build.json build: update to rules_typescript 0.25.1 (#28625) 2019-02-21 07:46:21 -08:00
tsconfig-test.json build: update to rules_typescript 0.25.1 (#28625) 2019-02-21 07:46:21 -08:00
tsconfig.json ci: saucelabs-legacy job should not run schematic core tests (#29124) 2019-03-05 16:10:08 -08:00
types.d.ts build: switch to typescript's es2015 typings (#28570) 2019-02-06 14:17:55 -05:00

Angular

The sources for this package are in the main Angular repo. Please file issues and pull requests against that repo.

License: MIT