Commit Graph

508 Commits

Author SHA1 Message Date
Alex Rickabaugh 84dd2679a9 fix(core): require 'static' flag on queries in typings (#30639)
This commit makes the static flag on @ViewChild and @ContentChild required.

BREAKING CHANGE:

In Angular version 8, it's required that all @ViewChild and @ContentChild
queries have a 'static' flag specifying whether the query is 'static' or
'dynamic'. The compiler previously sorted queries automatically, but in
8.0 developers are required to explicitly specify which behavior is wanted.
This is a temporary requirement as part of a migration; see
https://angular.io/guide/static-query-migration for more details.

@ViewChildren and @ContentChildren queries are always dynamic, and so are
unaffected.

PR Close #30639
2019-05-24 16:55:00 -04:00
Jason Aden 53f356427f fix(router): type cast correctly for IE 11 bug breaking URL Unification when comparing objects (#30464)
PR #30393 corrected behavior where Object.keys sometimes returns an `undefined` value. However, the types didn't reflect this in the code. That fix actually missed one value that could return `undefined`. This PR corrects this by casting the types to what they can be in IE 11. This ensures the code behaves as it should when this edge case comes up.

PR Close #30464
2019-05-15 14:09:53 -07:00
Jason Aden 79d4b16f8a Revert "Revert "fix(router): fix a problem with router not responding to back button (#30160)" (#30320)" (#30344)
This reverts commit 8ced321bb6.

PR Close #30344
2019-05-15 10:14:47 -07:00
Jason Aden 0fd9d086e4 fix(router): ensure navigations start with the current URL value incase redirect is skipped (#30344)
In some cases where multiple navigations happen to the same URL, the router will not process a given URL. In those cases, we fall into logic that resets state for the next navigation. One piece of this resetting is to set the `browserUrlTree` to the most recent `urlAfterRedirects`i.

However, there was bug in this logic because in some cases the `urlAfterRedirects` is a stale value. This happens any time a URL won't be processed, and the previous URL will also not be processed. This creates unpredictable behavior, not the least of which ends up being a broken `back` button.

This PR kicks off new navigations with the current value the router assumes is in the browser. All the logic around how to handle future navigations is based on this value compared to the current transition, so it's important to kick off all new navigations with the current value so in the edge case described above we don't end up with an old value being set into `browserUrlTree`.

Fixes #30340
Related to #30160

PR Close #30344
2019-05-15 10:14:47 -07:00
Jason Aden 197584d1af fix(router): IE 11 bug can break URL unification when comparing objects (#30393)
This PR fixes an issue where IE 11 can return `undefined` in with an `Object.keys` call. Solution is to add a runtime check on the value. Based on the types being passed, this shouldn't be necessary, but is needed only for IE 11. Unit test doesn't work for this PR because it can't be replicated easily.

PR Close #30393
2019-05-13 11:40:43 -07:00
Frederik Prijck 9a807bd26a docs(router): Move ActivatedRoute example to mini-app (#29755)
PR Close #29755
2019-05-08 13:52:22 -07:00
Jason Aden 8ced321bb6 Revert "fix(router): fix a problem with router not responding to back button (#30160)" (#30320)
This reverts commit 3327bd8eab.

PR Close #30320
2019-05-07 17:22:24 -07:00
Jason Aden b40f6f3eae fix(router): ensure `history.state` is set in `eager` update mode (#30154)
Without this change, `history.state` isn't being set when updating the browser URL in `eager` update mode.

PR Close #30154
2019-05-06 16:09:58 -07:00
Jason Aden 3327bd8eab fix(router): fix a problem with router not responding to back button (#30160)
There was a problem with a combination of the `eager` URL update, browser `back` button, and hybrid applications. Details provided in internal ticket http://b/123667227.

This fix handles the problem by setting `router.browserUrlTree` when all conditions have failed, meaning the browser doesn't do anything with the navigation other than update internal data structures. Without this change, the problem was an old value was stored in `router.broserUrlTree` causing some new navigations to be compared to an old value and breaking future navigations.

PR Close #30160
2019-05-06 16:06:58 -07:00
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
Trevor Karjanis 9873356bd0 docs: fix grammatical errors in the guides and API documentation (#29928)
Fix grammatical errors in the DI and HttpClient guides as well as the Resolve API documentaiton.

There is no associated issue.

PR Close #29928
2019-04-22 17:32:30 -07:00
Ben Lesh 94aeeec1dc build: update rxjs version requirements to 6.4.0 (#30032)
PR Close #30032
2019-04-22 11:15:33 -07:00
Brandon 78146c1890 docs: update extra options available for RouterModule.forRoot() method (#29846)
PR Close #29846
2019-04-17 17:25:31 -07:00
Filipe Silva 2bfb6a02e2 fix(router): support non-NgFactory promise in loadChildren typings (#29832)
PR Close #29832
2019-04-16 10:46:12 -07:00
Frederik Prijck e682b4453c docs(router): use pipe in activatedRoute example (#29752)
Copying the example, mentioned at Activated Route (https://angular.io/api/router/ActivatedRoute), to Stackblitz doesn't compile: https://stackblitz.com/edit/angular-x7pbeb?

That's because the example does not use .pipe.

I've updated the example to include `pipe`.
PR Close #29752
2019-04-08 17:18:06 -07:00
Judy Bogart b6f48dbe19 docs: correct route path description (#29669)
PR Close #29669
2019-04-04 15:40:59 -07:00
Jason Aden f9497bf28b fix(router): adjust setting navigationTransition when a new navigation cancels an existing one (#29636)
Prior to this change, if a navigation was ongoing and a new one came in, the router could get into a state where `router.currentNavigation` was `null` even though a navigation was executing. This change moves where we set the `currentNavigation` value so it's inside a `switchMap`. This solves the problem because the `finally` on the `switchMap` had been setting `currentNavigation` to `null` but the new `currentNavigation` value would have already been set. Essentially this was a timing problem and is resolved with this change.

Fixes #29389 #29590

PR Close #29636
2019-04-01 12:11:55 -07:00
ijz953 2b836c81a2 docs(router): clarify scrollPositionRestoration options, refactor example (#29260)
clarify scrollPositionRestoration enabled to fully describe the functionality it provides. refactor app module example to compile and remove dependency on unnecessary framework. Remove component example due to bug on reload.

PR Close #29260
2019-03-27 09:55:56 -07:00
Filipe Silva 26a8c5961e fix(router): support NgFactory promise in loadChildren typings (#29392)
The router loadChildren property already supports a promise that returns a NgModuleFactory, but the typings cause the compilation to fail.

PR Close #29392
2019-03-25 09:30:28 -07:00
Greg Magolan 2d7435daae build(bazel): fix router test failure (#29375)
PR Close #29375
2019-03-19 23:39:37 -04:00
Adam Plumer 7b70760c8d refactor: move DOCUMENT imports from platform-browser to common (#29237)
PR Close #29237
2019-03-14 16:01:57 -04:00
Judy Bogart aa6db0d191 docs: clarify intro and examples (#29012)
PR Close #29012
2019-03-07 15:34:28 -08:00
Judy Bogart b14df413eb docs: add publicapi flag (#29012)
PR Close #29012
2019-03-07 15:34:28 -08:00
Judy Bogart 22c71b69ce docs: route interface and types doc example (#29012)
PR Close #29012
2019-03-07 15:34:28 -08:00
Alan 941c99ad7f build: turn off dts bundling for packages that still are not supported (#29128)
PR Close #29128
2019-03-07 10:47:20 -08:00
Alan Agius 29f57e315e build: enable bundle_dts for router package (#28833)
This PR also changes the name of `EmptyOutletComponent` to `ɵEmptyOutletComponent`. This is because `ngcc` requires the node to retain the original name while dts bundler will rename the node is it's only exported using the aliases.

Example typings files:
```ts
declare class EmptyOutletComponent {
}
export {EmptyOutletComponent as ɵEmptyOutletComponent}
```

will be emitted as
```ts
export declare class ɵEmptyOutletComponent {
}
```

PR Close #28833
2019-03-07 07:30:44 -08:00
José Toledo Navarro 3063547975 docs(router): align examples in interfaces docs (#29093)
* Use exclusively `TeamComponent` class for examples, as currently there are at least 3 different component classes being used, one of which is actually as a type argument for a `Resolve<T>` implementation.
PR Close #29093
2019-03-05 09:45:52 -08:00
Maxim Mazurok 72ecc45363 fix(router): removed obsolete TODO comment (#29085)
PR Close #29085
2019-03-05 09:44:40 -08:00
Greg Magolan ea09430039 build: rules_nodejs 0.26.0 & use @npm instead of @ngdeps now that downstream angular build uses angular bundles (#28871)
PR Close #28871
2019-02-28 12:06:36 -08:00
Wassim Chegham ce68b4d839 style: enforce buildifier lint on CI (#28186)
PR Close #28186
2019-02-26 16:57:41 -08:00
Sarun Intaralawan 395fb186a4 docs(router): reword relativeLinkResolution docs to not mention version numbers (#26991)
PR Close #26991
2019-02-22 14:35:54 -08:00
Greg Magolan 75357ecb32 build(bazel): run a number of web tests with karma_web_test in saucelabs in CircleCI (#27721)
PR Close #27721
2019-02-22 13:07:08 -08:00
Greg Magolan 25aae64274 build(bazel): do not build rxjs from source under Bazel (#28720)
PR Close #28720
2019-02-19 16:28:14 -08:00
Jason Aden 71d0eeb966 feat(router): add hash-based navigation option to setUpLocationSync (#28609)
The `setUpLocationSync` function in @angular/router/upgrade didn't previously let you sync hash-based navigations. With this change, you can now pass an option to `setUpLocationSync` that will make sure location changes run in Angular in hash-based apps.

Fixes #24429 #21995

PR Close #28609
2019-02-19 16:20:35 -08:00
Zhicheng WANG b035e68480 Merge remote-tracking branch 'en/master' into aio
# Conflicts:
#	.travis.yml
#	aio/content/guide/aot-compiler.md
#	aio/content/guide/architecture.md
#	aio/content/guide/build.md
#	aio/content/guide/dependency-injection-in-action.md
#	aio/content/guide/deployment.md
#	aio/content/guide/elements.md
#	aio/content/guide/file-structure.md
#	aio/content/guide/glossary.md
#	aio/content/guide/hierarchical-dependency-injection.md
#	aio/content/guide/lifecycle-hooks.md
#	aio/content/guide/ngmodule-faq.md
#	aio/content/guide/pipes.md
#	aio/content/guide/router.md
#	aio/content/guide/rx-library.md
#	aio/content/guide/service-worker-communications.md
#	aio/content/guide/service-worker-config.md
#	aio/content/guide/singleton-services.md
#	aio/content/guide/template-syntax.md
#	aio/content/guide/testing.md
#	aio/content/guide/typescript-configuration.md
#	aio/content/guide/universal.md
#	aio/content/marketing/docs.md
#	aio/content/marketing/features.html
#	aio/content/tutorial/toh-pt0.md
#	aio/content/tutorial/toh-pt6.md
#	aio/package.json
#	aio/src/app/layout/footer/footer.component.html
#	aio/tools/transforms/templates/api/lib/memberHelpers.html
#	aio/yarn.lock
#	integration/cli-hello-world-ivy-minimal/src/polyfills.ts
#	modules/benchmarks/e2e_test/largetable_perf.ts
#	modules/benchmarks/e2e_test/largetable_spec.ts
#	packages/animations/src/animation_metadata.ts
#	packages/common/http/src/headers.ts
#	packages/common/http/src/interceptor.ts
#	packages/common/src/directives/ng_for_of.ts
#	packages/common/src/directives/ng_if.ts
#	packages/common/src/directives/ng_style.ts
#	packages/common/src/directives/ng_switch.ts
#	packages/core/src/change_detection/change_detection_util.ts
#	packages/core/src/di/injectable.ts
#	packages/core/src/interface/lifecycle_hooks.ts
#	packages/core/src/linker/template_ref.ts
#	packages/core/src/metadata/di.ts
#	packages/core/src/metadata/directives.ts
#	packages/core/src/metadata/ng_module.ts
#	packages/core/src/render/api.ts
#	packages/forms/src/form_providers.ts
#	packages/forms/src/model.ts
#	packages/router/src/config.ts
#	packages/router/src/directives/router_link.ts
2019-02-17 00:00:16 +08:00
Zhicheng WANG 1d6c1396fd fix: 修复一些翻译错误 2019-02-15 07:12:39 +08:00
Paul Gschwendtner 7cbc36fdac build: remove unused rollup.config.js files (#28646)
Since we build and publish the individual packages
using Bazel and `build.sh` has been removed, we can
safely remove the `rollup.config.js` files which are no
longer needed because the `ng_package` bazel rule
automatically handles the rollup settings and globals.

PR Close #28646
2019-02-14 19:28:08 +00:00
Pawel Kozlowski fcd1f61476 refactor(router): change RouterLinkActive impl to account for upcoming ivy breaking change (#28560)
PR Close #28560
2019-02-08 16:42:45 -08:00
stoneLeaf 50732e1564 fix(router): redirect to root url when returned as UrlTree from guard (#28271)
When a UrlTree of root url was returned by a guard as a redirection, the
navigation was not processed. The issue came from the error handler which
incorrectly marked the router as already navigated.

Fixes #27845

PR Close #28271
2019-02-06 21:23:32 -08:00
kevinphelps ed0cf7e2cb fix(router): set href when routerLink is used on an 'area' element (#28441)
closes #28401

PR Close #28441
2019-02-05 23:28:40 -05:00
Paul Gschwendtner 40d64b6b58 build: run offline_compiler_test using bazel (#28191)
PR Close #28191
2019-01-28 20:07:22 -08:00
Jason Aden b2811e50c5 refactor(router): initalize browserUrlTree to empty tree (#28376)
The value here is unimportant on initialization since it's not looked at until the second navigation. However, sometimes in testing  the `Location` service is mocked out, or the Router constructor manually called. Assuming `Location` exists in the constructor leads to test failures in `google3` therefore we initialize to a value that will not cause errors.

PR Close #28376
2019-01-25 12:37:56 -08:00
William Neely 03c8528fcb docs(router): removed additional to (#25989)
PR Close #25989
2019-01-23 11:00:20 -08:00
Jason Aden 50df897fdc fix(router): `skipLocationChange` with named outlets (#28300)
With #27680, a bug was fixed where multiple redirects using `eager` URL update could cause navigation to fail. However, that fix introduced a problem where with `skipLocationChange` enabled, the URL tree rendered was not properly stored for reference. This specifically caused an issue with named router outlets and subsequent navigations not being recognized.

This PR stores the correct `UrlTree` for reference with later navigations. It fixes the regression introdued with #27680.

Fixes #28200

PR Close #28300
2019-01-22 15:15:02 -08:00
Jason Aden 33e49c2894 Revert "revert: fix(router): ensure URL is updated after second redirect with UrlUpdateStrategy="eager" (#27523)" (#28300)
This reverts commit eea2b0f288.

PR Close #28300
2019-01-22 15:15:02 -08:00
Alex Eagle 38343a2388 build: set a default module_name for ts_library rules (#28051)
PR Close #28051
2019-01-18 10:16:39 -08:00
Jason Aden 9460218f36 docs(router): add clarification for Router config (#28159)
PR Close #28159
2019-01-15 10:54:49 -08:00
Kara Erickson 6fff74e576 test(ivy): re-enable passing tests and misc cleanup (#28093)
PR Close #28093
2019-01-14 10:03:57 -08:00
Alex Rickabaugh 51e716b6f2 feat(ivy): implement a Compiler for use in TestBedRender3 (#28033)
Previously when testing code injected the Compiler, it received the
top-level Compiler implementation defined in linker/compiler.ts
(and governed by the __PRE_R3__ switch). Code running under the
TestBed, however, should always use a TestBed-aware Compiler
implementation.

This commit adds such an implementation to the TestBedRender3,
which passes compiled modules through the _compileNgModule()
function.

With this change, 3 formerly disabled router integration tests
now pass.

FW-855 #resolve

PR Close #28033
2019-01-11 11:18:10 -08:00
Igor Minar 3ea9f0974a docs(router): remove obsolete sections in README.md (#27880)
PR Close #27880
2019-01-11 11:15:59 -08:00
Adam Plumer a100472b5d build: bump year (#27880)
PR Close #27880
2019-01-11 11:15:59 -08:00
Karanveer Plaha 26a8c095d0 docs(router): fixed a typo in CanLoad title text (#27894)
* Interface that a class can implement to be a guard deciding if a children can be loaded.
'...if a children...' changed to '...if children...'
 * Interface that a class can implement to be a guard deciding if children can be loaded.

PR Close #27894
2019-01-10 17:06:55 -08:00
Kara Erickson ad6569c744 fix(ivy): markForCheck() should not schedule change detection (#28048)
Previously, we had the logic to schedule a change detection tick
inside markViewDirty(). This is fine when used in markDirty(),
the user-facing API, because it should always schedule change
detection. However, this doesn't work when used in markForCheck()
because historically markForCheck() does not trigger change
detection.

To be backwards compatible, this commit moves the scheduling
logic out of markViewDirty() and into markDirty(), so
markForCheck no longer triggers a tick.

PR Close #28048
2019-01-10 13:37:40 -08:00
Kara Erickson e0e92cfef6 test(ivy): diagnose root causes of remaining failing router tests (#28035)
PR Close #28035
2019-01-10 10:54:37 -08:00
Marc Laval 5609764886 test(ivy): add root causes for router TestBed failures (#28014)
PR Close #28014
2019-01-09 11:49:45 -08:00
Miško Hevery b9c6df6da7 fix(ivy): use NgZone.onStable when bootstraped using PlatformRef (#27898)
PR Close #27898
2019-01-08 14:10:53 -08:00
Zhicheng WANG 8744f17f5d Merge remote-tracking branch 'en/master' into aio
# Conflicts:
#	aio/content/cli/index.md
#	aio/content/file-not-found.md
#	aio/content/guide/architecture-modules.md
#	aio/content/guide/architecture-services.md
#	aio/content/guide/build.md
#	aio/content/guide/deployment.md
#	aio/content/guide/elements.md
#	aio/content/guide/feature-modules.md
#	aio/content/guide/file-structure.md
#	aio/content/guide/forms-overview.md
#	aio/content/guide/glossary.md
#	aio/content/guide/i18n.md
#	aio/content/guide/npm-packages.md
#	aio/content/guide/releases.md
#	aio/content/guide/router.md
#	aio/content/guide/service-worker-config.md
#	aio/content/guide/service-worker-intro.md
#	aio/content/guide/testing.md
#	aio/content/guide/upgrade-performance.md
#	aio/content/navigation.json
#	aio/content/tutorial/toh-pt0.md
#	aio/content/tutorial/toh-pt5.md
#	aio/content/tutorial/toh-pt6.md
#	aio/package.json
#	aio/src/app/custom-elements/api/api-list.component.ts
#	aio/src/app/documents/document.service.ts
#	aio/src/app/layout/top-menu/top-menu.component.ts
#	aio/src/index.html
#	aio/src/styles/2-modules/_api-pages.scss
#	aio/tools/transforms/templates/api/base.template.html
#	aio/tools/transforms/templates/api/lib/memberHelpers.html
#	aio/tools/transforms/templates/cli/cli-container.template.html
#	aio/tools/transforms/templates/lib/githubLinks.html
#	aio/yarn.lock
#	packages/animations/src/animation_metadata.ts
#	packages/common/http/src/backend.ts
#	packages/common/http/src/client.ts
#	packages/common/http/src/headers.ts
#	packages/common/http/src/interceptor.ts
#	packages/common/http/src/module.ts
#	packages/common/http/src/params.ts
#	packages/common/http/src/request.ts
#	packages/common/http/src/response.ts
#	packages/common/src/common_module.ts
#	packages/common/src/directives/ng_class.ts
#	packages/common/src/directives/ng_style.ts
#	packages/common/src/directives/ng_switch.ts
#	packages/common/src/i18n/format_date.ts
#	packages/common/src/pipes/number_pipe.ts
#	packages/core/src/change_detection/change_detection_util.ts
#	packages/core/src/change_detection/pipe_transform.ts
#	packages/core/src/di/injectable.ts
#	packages/core/src/linker/element_ref.ts
#	packages/core/src/linker/template_ref.ts
#	packages/core/src/metadata/di.ts
#	packages/core/src/metadata/directives.ts
#	packages/core/src/metadata/lifecycle_hooks.ts
#	packages/core/src/metadata/ng_module.ts
#	packages/core/src/render/api.ts
#	packages/forms/src/directives/form_interface.ts
#	packages/forms/src/directives/ng_form.ts
#	packages/forms/src/directives/ng_model.ts
#	packages/forms/src/directives/reactive_directives/form_control_name.ts
#	packages/forms/src/directives/select_control_value_accessor.ts
#	packages/forms/src/directives/validators.ts
#	packages/forms/src/form_builder.ts
#	packages/forms/src/form_providers.ts
#	packages/forms/src/model.ts
#	packages/forms/src/validators.ts
#	packages/platform-browser/src/browser.ts
#	packages/platform-browser/src/security/dom_sanitization_service.ts
#	packages/router/src/config.ts
#	packages/router/src/events.ts
#	packages/router/src/router.ts
#	packages/router/src/router_module.ts
#	packages/router/src/shared.ts
2018-12-29 16:04:37 +08:00
Matias Niemelä eea2b0f288 revert: fix(router): ensure URL is updated after second redirect with UrlUpdateStrategy="eager" (#27523) 2018-12-25 22:14:07 -08:00
Marc Laval 5da55d6246 test(ivy): add root cause analysis for failing router tests (#27792)
PR Close #27792
2018-12-21 15:06:56 -05:00
Jason Aden 07ada7f3d9 fix(router): ensure URL is updated after second redirect with UrlUpdateStrategy="eager" (#27523)
Navigating to a route such as `/users`, you may get redirected to `/login`. Previously, if you go then route to `/users` again the URL will end up showing `/users` after the second redirect. This only happened in `UrlUpdateStrategy="eager"`. This is now fixed so after the second redirect, the URL shows the correct page.

Fixes #27116

PR Close #27523
2018-12-20 16:18:52 -05:00
Jason Aden 12c317603a feat(router): add predicate function mode for runGuardsAndResolvers (#27682)
This option means guards and resolvers will ignore changes when a provided predicate function returns `false`. This supports use cases where an application needs to ignore some param updates but not others. For example, changing a sort param in the URL might need to be ignored, whereas changing the a `project` param might require re-run of guards and resolvers.

Related to #26861 #18253 #27464

PR Close #27682
2018-12-18 13:55:06 -08:00
Andrew Kushnir 4bf8d64c56 fix(ivy): restore `fixmeIvy` imports for Router-related tests (#27720)
It looks like `fixmeIvy` imports were accidentally removed from Router integration tests, thus causing build errors. The necessary imports are now restored and the project should build normally.

PR Close #27720
2018-12-17 20:12:15 -08:00
Kara Erickson 062c7af4f3 test(ivy): replace resolved issue in compiler-cli test with new root cause (#27709)
PR Close #27709
2018-12-17 16:46:42 -08:00
Miško Hevery e94975d109 fix(ivy): check semantics of NgModule for consistency (#27604)
`NgModule` requires that `Component`s/`Directive`s/`Pipe`s are listed in
declarations, and that each `Component`s/`Directive`s/`Pipe` is declared
in exactly one `NgModule`. This change adds runtime checks to ensure
that these sementics are true at runtime.

There will need to be seperate set of checks for the AoT path of the
codebase to verify that same set of semantics hold. Due to current
design there does not seem to be an easy way to share the two checks
because JIT deal with references where as AoT deals with AST nodes.

PR Close #27604
2018-12-17 14:49:51 -08:00
cexbrayat 0b78f54d4f docs(router): typo in state documentation (#27671)
PR Close #27671
2018-12-14 15:13:45 -08:00
Miško Hevery 650c5a02ac Revert "fix(router): ensure URL is updated after second redirect with UrlUpdateStrategy="eager" (#27523)"
This reverts commit ad26cd6d0c.
2018-12-14 13:18:16 -08:00
Alex Eagle d32939d51a build: restrict visibility of npm_package targets (#27611)
dependencies on these cause very long rebuilds which have to re-package angular.
Such tests belong in the integration/ folder

PR Close #27611
2018-12-14 10:20:40 -08:00
Jason Aden ad26cd6d0c fix(router): ensure URL is updated after second redirect with UrlUpdateStrategy="eager" (#27523)
Navigating to a route such as `/users`, you may get redirected to `/login`. Previously, if you go then route to `/users` again the URL will end up showing `/users` after the second redirect. This only happened in `UrlUpdateStrategy="eager"`. This is now fixed so after the second redirect, the URL shows the correct page.

Fixes #27116

PR Close #27523
2018-12-13 14:59:41 -08:00
Marc Laval f013c57186 test(router): correct a wrong test (FW-766) (#27511)
PR Close #27511
2018-12-06 13:41:20 -08:00
Marc Laval 8fa7e93c30 test(ivy): enable router tests with pending timers (FW-768) (#27509)
PR Close #27509
2018-12-06 13:40:42 -08:00
Marc Laval 8e9858fadb fix(ivy): align NgModuleRef implementation between Ivy and ViewEngine (#27482)
Solves FW-765 and FW-767

PR Close #27482
2018-12-06 13:35:08 -08:00
Igor Minar 091a504377 Revert "fix(router): change processing url tree children condition (#26243)" (#27516)
This reverts commit ccc77ca441.

Breaks Pantheon see cl/224256517.

PR Close #27516
2018-12-06 09:17:20 -08:00
Igor Minar 4f61832d1c Revert "fix(router): process empty path segment when preceding a named outlet (#26243)" (#27516)
This reverts commit 20cef5078d.

Breaks Pantheon see cl/224256517.

PR Close #27516
2018-12-06 09:17:20 -08:00
Alex Rickabaugh f514ac3da2 test(ivy): enable //packages/router/test/aot_ngsummary_test in Ivy mode (#27483)
This commit enables the above test to run under --define=compile=aot.
To accomplish this, one import is rewritten from a strange form to the
correct absolute form.

FW-658 #resolve

PR Close #27483
2018-12-05 16:26:39 -08:00
Jason Aden d70a7f3ac9 feat(router): add pathParamsOrQueryParamsChange mode for runGuardsAndResolvers (#27464)
This option means guards and resolvers will ignore changes to matrix parameters. Guards and resolvers will be rerun when the path changes, when path parameters change, or when query parameters change.

The primary use case for such a mode is when updating the UI and getting the URL to be in sync with local changes. For example, if displaying a sortable table, changing the sort direction is often handled by the table itself. But you would want to update the URL to be in sync with what's being displayed to the user. As long as the table sort direction is stored as a matrix parameter, you can use this option to update the URL without causing the overhead of re-running guards and resolvers.

Related to #26861 #18253

PR Close #27464
2018-12-05 10:43:29 -08:00
miginmrs 20cef5078d fix(router): process empty path segment when preceding a named outlet (#26243)
PR Close #10726

PR Close #26243
2018-12-05 10:39:30 -08:00
miginmrs ccc77ca441 fix(router): change processing url tree children condition (#26243)
stop adding next path of pathless activated route to the url

PR Close #26224

PR Close #26243
2018-12-05 10:39:30 -08:00
Misko Hevery f52600e261 test(ivy): add ability to find already passing tests (#27449)
PR Close #27449
2018-12-05 09:34:52 -08:00
Marc Laval 8973f12ee4 fix(ivy): provided Injector should be instantiated by its factory (#27456)
(FW-777)

When an Injector is provided, R3Injector instantiates it by calling its
constructor instead of its factory, not resolving dependencies.
With this fix, the ngInjectorDef is checked and the factory is correctly
used if it is found.

PR Close #27456
2018-12-04 20:01:49 -08:00
Jason Aden 0d4149c736 test(router): add test verifying guards re-run when parent path segments change (#27440)
Related to #26861

PR Close #27440
2018-12-04 19:59:53 -08:00
Marc Laval bd864fb274 feat(ivy): support WrappedValue in pipes (FW-726) (#27409)
PR Close #27409
2018-12-04 19:59:01 -08:00
Marc Laval 0cf49c8de3 test(ivy): run router/upgrade tests with ivy on CI (#27410)
PR Close #27410
2018-12-03 14:54:20 -08:00
Marc Laval 35e02ad5e0 test(ivy): add root causes for router TestBed failures (#27325)
PR Close #27325
2018-11-30 14:58:22 -08:00
Marc Laval a566e52ca4 test(ivy): run more router tests in CI (#27325)
PR Close #27325
2018-11-30 14:58:22 -08:00
Jason Aden d40af0c137 feat(router): add a Navigation type available during navigation (#27198)
Provides target URLs, Navigation, and `NavigationExtras` data.

FW-613

PR Close #27198
2018-11-30 13:34:55 -08:00
Jason Aden 73f6ed9be1 feat(router): allow passing `state` to routerLink directives (#27198)
This value will get written to the `history.state` entry.

FW-613 (related)
Related to #24617

PR Close #27198
2018-11-30 13:34:55 -08:00
Jason Aden 67f4a5d4bd feat(router): allow passing state to `NavigationExtras` (#27198)
This value will get written to the `history.state` entry.

FW-613 (related)

PR Close #27198
2018-11-30 13:34:55 -08:00
Jason Aden 26842491c6 feat(router): restore whole object when navigating back to a page managed by Angular router (#27198)
PR Close #27198
2018-11-30 13:34:55 -08:00
Jason Aden 11a8bd8aca fix(router): update URL after redirects when urlHandlingStrategy='eager' (#27356)
fixes #27076

PR Close #27356
2018-11-29 14:46:32 -08:00
Misko Hevery 39e426cde3 fix(ivy): TestBed.get(Compiler) throws "Error: Runtime compiler is not loaded" (#27223)
BREAKING CHANGE:

The public API for `DebugNode` was accidentally too broad. This change removes
1. Public constructor. Since `DebugNode` is a way for Angular to communicate information
   on to the developer there is no reason why the developer should ever need to
   Instantiate the `DebugNode`
2. We are also removing `removeChild`, `addChild`, `insertBefore`, and `insertChildAfter`.
   All of these methods are used by Angular to constructor the correct `DebugNode` tree.
   There is no reason why the developer should ever be constructing a `DebugNode` tree
   And these methods should have never been made public.
3. All properties have been change to `readonly` since `DebugNode` is used by Angular
   to communicate to developer and there is no reason why these APIs should be writable.

While technically breaking change we don’t expect anyone to be effected by this change.

PR Close #27223
2018-11-27 13:42:23 -08:00
Igor Minar 572fd7a79a build(ivy): remove the remains of ivy-jit mode (#27278)
This stuff is obsolete and shouldn't be here because we removed the JIT mode on CI.

PR Close #27278
2018-11-27 10:30:58 -08:00
Marc Laval c2f30542e7 fix(ivy): should support components without selector (#27169)
PR Close #27169
2018-11-27 10:17:35 -08:00
Marc Laval 8ce59a583b test(ivy): run router tests with ivy on CI (#27195)
PR Close #27195
2018-11-21 09:19:40 -08:00
Jason Aden bf6ac6cef8 feat(router): add pathParamsChange mode for runGuardsAndResolvers (#26861)
This option means guards and resolvers will ignore changes to optional
parameters such as query and matrix params. When the path or any path
params change, guards and resolvers will be run

Related to discussion in #18253
FW-560 #resolve

PR Close #26861
2018-11-14 12:24:43 -08:00
Sarun Intaralawan a752971bca fix(router): add `relativeLinkResolution` to `recognize` operator (#26990)
Close #26983

PR Close #26990
2018-11-13 16:18:08 -08:00
Andrew Lobban 4efb460127 docs(router): add RxJS filter pipe operator to example (#25686)
This example for Angular 6 requires piping the RxJS filter operator in order to traverse the multitude of Router Events.

PR Close #25686
2018-11-09 09:46:11 -08:00
Misko Hevery 7d2a746090 build: remove ivy JIT mode (#26863)
PR Close #26863
2018-11-02 15:44:05 -07:00
Jason Aden 496372dd30 fix(router): remove type bludgeoning of context and outlet when running CanDeactivate (#26496)
Fixes #18253

PR Close #26496
2018-11-01 16:04:01 -07:00
Pete Bacon Darwin 86580a8460 style(router): remove trailing whitespace (#26891)
PR Close #26891
2018-11-01 05:28:17 -07:00
Jason Aden 4e9f2e5895 feat(router): guard returning UrlTree cancels current navigation and redirects (#26521)
Fixes #24618
FW-153 #resolve

PR Close #26521
2018-10-31 19:51:50 -04:00
Jason Aden 081f95c812 feat(router): allow guards to return UrlTree as well as boolean (#26521)
* Removed `andObservable` helper function in favor of inline implementation
* Flow `boolean | UrlTree` through guards check
* Add tests to verify behavior of `checkGuards` function flowing `UrlTree` properly

PR Close #26521
2018-10-31 19:51:50 -04:00
Jason Aden 152ca66eba feat(router): allow redirect from guards by returning UrlTree (#26521)
* Improve type checking within the CheckGuards function
* Change public API to allow returning of UrlTree instead of boolean

PR Close #26521
2018-10-31 19:51:50 -04:00
Jason Aden 17586f1e94 refactor(router): remove type casting from wrapIntoObservable private function (#26521)
PR Close #26521
2018-10-31 19:51:50 -04:00
Jason Aden 6712492dc2 refactor(router): add type definitions for guard functions (#26521)
PR Close #26521
2018-10-31 19:51:50 -04:00
Jason Aden 9f4299d47b refactor(router): add type guards for router guards (#26521)
PR Close #26521
2018-10-31 19:51:49 -04:00
Igor Minar ee0b857172 build: rename the ivy compile mode 'local' to 'aot' (#26686)
PR Close #26686
2018-10-23 14:14:49 -07:00
Igor Minar 4237c34c78 test(ivy): mark failing test targets with fixme-ivy-jit and fixme-ivy-local tags (#26471)
We are close enough to blacklist a few test targets, rather than whitelist targets to run...

Because bazel rules can be composed of other rules that don't inherit tags automatically,
I had to explicitly mark all of our ts_library and ng_module targes with "ivy-local" and
"ivy-jit" tags so that we can create a query that excludes all fixme- tagged targets even
if those targets are composed of other targets that don't inherit this tag.

This is the updated overview of ivy related bazel tags:

- ivy-only: target that builds or runs only under ivy
- fixme-ivy-jit: target that doesn't yet build or run under ivy with --compile=jit
- fixme-ivy-local: target that doesn't yet build or run under ivy with --compile=local
- no-ivy-jit: target that is not intended to build or run under ivy with --compile=jit
- no-ivy-local: target that is not intended to build or run under ivy with --compile=local

PR Close #26471
2018-10-23 08:57:42 -07:00
Zhicheng Wang 9a0d3e9633 docs: 手动解决冲突 2018-10-22 18:16:47 +08:00
Zhicheng Wang a9ac90d3df Merge remote-tracking branch 'en/master' into aio
# Conflicts:
#	aio/content/guide/ajs-quick-reference.md
#	aio/content/guide/animations.md
#	aio/content/guide/aot-compiler.md
#	aio/content/guide/architecture-components.md
#	aio/content/guide/architecture-modules.md
#	aio/content/guide/architecture-next-steps.md
#	aio/content/guide/architecture-services.md
#	aio/content/guide/architecture.md
#	aio/content/guide/attribute-directives.md
#	aio/content/guide/bootstrapping.md
#	aio/content/guide/browser-support.md
#	aio/content/guide/cheatsheet.md
#	aio/content/guide/comparing-observables.md
#	aio/content/guide/component-interaction.md
#	aio/content/guide/component-styles.md
#	aio/content/guide/dependency-injection-in-action.md
#	aio/content/guide/dependency-injection-pattern.md
#	aio/content/guide/dependency-injection.md
#	aio/content/guide/deployment.md
#	aio/content/guide/displaying-data.md
#	aio/content/guide/dynamic-component-loader.md
#	aio/content/guide/elements.md
#	aio/content/guide/feature-modules.md
#	aio/content/guide/form-validation.md
#	aio/content/guide/forms.md
#	aio/content/guide/glossary.md
#	aio/content/guide/hierarchical-dependency-injection.md
#	aio/content/guide/i18n.md
#	aio/content/guide/lazy-loading-ngmodules.md
#	aio/content/guide/lifecycle-hooks.md
#	aio/content/guide/ngmodule-faq.md
#	aio/content/guide/ngmodule-vs-jsmodule.md
#	aio/content/guide/ngmodules.md
#	aio/content/guide/npm-packages.md
#	aio/content/guide/observables-in-angular.md
#	aio/content/guide/observables.md
#	aio/content/guide/pipes.md
#	aio/content/guide/practical-observable-usage.md
#	aio/content/guide/providers.md
#	aio/content/guide/quickstart.md
#	aio/content/guide/reactive-forms.md
#	aio/content/guide/router.md
#	aio/content/guide/rx-library.md
#	aio/content/guide/security.md
#	aio/content/guide/service-worker-communications.md
#	aio/content/guide/service-worker-getting-started.md
#	aio/content/guide/service-worker-intro.md
#	aio/content/guide/setup-systemjs-anatomy.md
#	aio/content/guide/setup.md
#	aio/content/guide/singleton-services.md
#	aio/content/guide/structural-directives.md
#	aio/content/guide/styleguide.md
#	aio/content/guide/template-syntax.md
#	aio/content/guide/testing.md
#	aio/content/guide/typescript-configuration.md
#	aio/content/guide/universal.md
#	aio/content/guide/updating.md
#	aio/content/guide/upgrade.md
#	aio/content/guide/user-input.md
#	aio/content/guide/visual-studio-2015.md
#	aio/content/marketing/docs.md
#	aio/content/navigation.json
#	aio/content/tutorial/toh-pt0.md
#	aio/content/tutorial/toh-pt1.md
#	aio/content/tutorial/toh-pt2.md
#	aio/content/tutorial/toh-pt3.md
#	aio/content/tutorial/toh-pt4.md
#	aio/content/tutorial/toh-pt5.md
#	aio/content/tutorial/toh-pt6.md
#	aio/ngsw-manifest.json
#	aio/package.json
#	aio/src/app/custom-elements/api/api-list.component.html
#	aio/src/app/custom-elements/api/api-list.component.ts
#	aio/src/index.html
#	aio/tools/transforms/templates/api/base.template.html
#	aio/tools/transforms/templates/api/class.template.html
#	aio/tools/transforms/templates/api/directive.template.html
#	aio/tools/transforms/templates/api/enum.template.html
#	aio/tools/transforms/templates/api/includes/class-overview.html
#	aio/tools/transforms/templates/api/includes/deprecation.html
#	aio/tools/transforms/templates/api/includes/export-as.html
#	aio/tools/transforms/templates/api/includes/info-bar.html
#	aio/tools/transforms/templates/api/includes/interface-overview.html
#	aio/tools/transforms/templates/api/includes/selectors.html
#	aio/tools/transforms/templates/api/lib/directiveHelpers.html
#	aio/tools/transforms/templates/api/lib/githubLinks.html
#	aio/tools/transforms/templates/api/lib/memberHelpers.html
#	aio/tools/transforms/templates/api/package.template.html
#	aio/yarn.lock
#	packages/common/http/src/module.ts
#	packages/common/src/common_module.ts
#	packages/common/src/directives/ng_for_of.ts
#	packages/common/src/directives/ng_if.ts
#	packages/common/src/directives/ng_template_outlet.ts
#	packages/common/src/location/location.ts
#	packages/common/src/pipes/async_pipe.ts
#	packages/common/src/pipes/json_pipe.ts
#	packages/common/src/pipes/number_pipe.ts
#	packages/common/src/pipes/slice_pipe.ts
#	packages/core/src/change_detection/change_detector_ref.ts
#	packages/core/src/di/injectable.ts
#	packages/core/src/linker/template_ref.ts
#	packages/core/src/linker/view_container_ref.ts
#	packages/core/src/metadata/di.ts
#	packages/core/src/metadata/ng_module.ts
#	packages/core/src/render/api.ts
#	packages/forms/src/directives/form_interface.ts
#	packages/forms/src/directives/ng_form.ts
#	packages/forms/src/directives/ng_model.ts
#	packages/forms/src/directives/reactive_directives/form_control_name.ts
#	packages/forms/src/directives/select_control_value_accessor.ts
#	packages/forms/src/directives/validators.ts
#	packages/forms/src/form_providers.ts
#	packages/forms/src/model.ts
#	packages/forms/src/validators.ts
#	packages/router/src/config.ts
#	packages/router/src/router.ts
#	packages/router/src/router_module.ts
#	packages/router/src/router_state.ts
2018-10-21 17:43:29 +08:00
Pete Bacon Darwin 13143b850e docs: update router to use `@publicApi` tags (#26595)
PR Close #26595
2018-10-19 14:35:53 -07:00
Pete Bacon Darwin 24521f549c docs: convert all `@experimental` tags to `@publicApi` tags (#26595)
PR Close #26595
2018-10-19 14:35:52 -07:00
Jason Aden fdfedceeec feat(router): add prioritizedGuardValue operator optimization and allowing UrlTree return from guard (#26478)
* If all guards return `true`, operator returns `true`
* `false` and `UrlTree` are now both valid returns from a guard
* Both these values wait for higher priority guards to resolve
* Highest priority `false` or `UrlTree` value will be returned

PR Close #26478
2018-10-16 20:31:32 -07:00
Jason Aden 1c9b06504b fix(router): fix regression where navigateByUrl promise didn't resolve on CanLoad failure (#26455)
Fixes #26284

PR Close #26455
2018-10-15 16:53:25 -07:00
Judy Bogart f543d71cc3 docs: add package doc files (#26047)
PR Close #26047
2018-10-05 15:42:14 -07:00
Jason Aden 532e53678d refactor(router): get guards only one time and simplify guard operator signature (#26239)
PR Close #26239
2018-10-04 10:10:28 -07:00
Jason Aden f859d83298 refactor(router): move pre activation helpers into utils (#26239)
PR Close #26239
2018-10-04 10:10:28 -07:00
Jason Aden ac68c75e26 refactor(router): convert PreActivation's resolve data to pure functions & remove PreActivation class (#26239)
PR Close #26239
2018-10-04 10:10:28 -07:00
Jason Aden fe45b9cebd refactor(router): convert PreActivation's check guards to pure functions (#26239)
PR Close #26239
2018-10-04 10:10:28 -07:00
Jason Aden 9523991a9b refactor(router): cleanup to navigation stream for readability and documentation (#25740)
* Pull out `activateRoutes` into new operator
* Add `asyncTap` operator
* Use `asyncTap` operator for router hooks and remove corresponding abstracted operators
* Clean up formatting
* Minor performance improvements

PR Close #25740
2018-09-27 14:02:58 -07:00
Jason Aden 9acd04c192 refactor(router): update test based on router quick-cancelling ongoing navigations (#25740)
PR Close #25740
2018-09-27 14:02:58 -07:00
Jason Aden c091d40fb0 refactor(router): make sure redirect within NavigationStart event works (#25740)
PR Close #25740
2018-09-27 14:02:58 -07:00
Jason Aden b7baf632c0 refactor(router): move routing into a single Observable stream (#25740)
This is a major refactor of how the router previously worked. There are a couple major advantages of this refactor, and future work will be built on top of it.

First, we will no longer have multiple navigations running at the same time. Previously, a new navigation wouldn't cause the old navigation to be cancelled and cleaned up. Instead, multiple navigations could be going at once, and we imperatively checked that we were operating on the most current `router.navigationId` as we progressed through the Observable streams. This had some major faults, the biggest of which was async races where an ongoing async action could result in a redirect once the async action completed, but there was no way to guarantee there weren't also other redirects that would be queued up by other async actions. After this refactor, there's a single Observable stream that will get cleaned up each time a new navigation is requested.

Additionally, the individual pieces of routing have been pulled out into their own operators. While this was needed in order to create one continuous stream, it also will allow future improvements to the testing APIs as things such as Guards or Resolvers should now be able to be tested in much more isolation.

* Add the new `router.transitions` observable of the new `NavigationTransition` type to contain the transition information
* Update `router.navigations` to pipe off of `router.transitions`
* Re-write navigation Observable flow to a single configured stream
* Refactor `switchMap` instead of the previous `mergeMap` to ensure new navigations cause a cancellation and cleanup of already running navigations
* Wire in existing error and cancellation logic so cancellation matches previous behavior

PR Close #25740
2018-09-27 14:02:57 -07:00
Jason Aden 4c0d4fc649 refactor(router): create pipeable afterPreactivation function (#25740)
PR Close #25740
2018-09-27 14:02:57 -07:00
Jason Aden 5b3c08b237 refactor(router): create pipeable resolveData function (#25740)
PR Close #25740
2018-09-27 14:02:57 -07:00
Jason Aden 68f2e0c391 refactor(router): create pipeable checkGuards function (#25740)
PR Close #25740
2018-09-27 14:02:57 -07:00
Jason Aden 9c1c945489 refactor(router): create pipeable setupPreactivation function (#25740)
PR Close #25740
2018-09-27 14:02:57 -07:00
Jason Aden ef5338663d refactor(router): create pipeable beforePreactivation function (#25740)
PR Close #25740
2018-09-27 14:02:57 -07:00
Jason Aden 380b3d7653 refactor(router): create pipeable applyRedirects function (#25740)
PR Close #25740
2018-09-27 14:02:57 -07:00
Jason Aden 4decc8521d refactor(router): create pipeable recognize function (#25740)
PR Close #25740
2018-09-27 14:02:57 -07:00
Pete Bacon Darwin ff028f0b39 docs(router): move examples to `@usageNotes` (#26039)
PR Close #26039
2018-09-24 09:11:02 -07:00
Kara Erickson e7ade38731 Revert "refactor(router): cleanup to navigation stream for readability" and associated changes (#26060)
PR Close #26060
2018-09-21 10:15:43 -07:00
Jason Aden 64aa6701f6 refactor(router): cleanup to navigation stream for readability and documentation (#25740)
* Pull out `activateRoutes` into new operator
* Add `asyncTap` operator
* Use `asyncTap` operator for router hooks and remove corresponding abstracted operators
* Clean up formatting
* Minor performance improvements

PR Close #25740
2018-09-20 17:42:58 -07:00
Jason Aden 12ccf57340 refactor(router): update test based on router quick-cancelling ongoing navigations (#25740)
PR Close #25740
2018-09-20 17:42:58 -07:00
Jason Aden c634176035 refactor(router): make sure redirect within NavigationStart event works (#25740)
PR Close #25740
2018-09-20 17:42:58 -07:00
Jason Aden 4bb10d224c refactor(router): move routing into a single Observable stream (#25740)
This is a major refactor of how the router previously worked. There are a couple major advantages of this refactor, and future work will be built on top of it.

First, we will no longer have multiple navigations running at the same time. Previously, a new navigation wouldn't cause the old navigation to be cancelled and cleaned up. Instead, multiple navigations could be going at once, and we imperatively checked that we were operating on the most current `router.navigationId` as we progressed through the Observable streams. This had some major faults, the biggest of which was async races where an ongoing async action could result in a redirect once the async action completed, but there was no way to guarantee there weren't also other redirects that would be queued up by other async actions. After this refactor, there's a single Observable stream that will get cleaned up each time a new navigation is requested.

Additionally, the individual pieces of routing have been pulled out into their own operators. While this was needed in order to create one continuous stream, it also will allow future improvements to the testing APIs as things such as Guards or Resolvers should now be able to be tested in much more isolation.

* Add the new `router.transitions` observable of the new `NavigationTransition` type to contain the transition information
* Update `router.navigations` to pipe off of `router.transitions`
* Re-write navigation Observable flow to a single configured stream
* Refactor `switchMap` instead of the previous `mergeMap` to ensure new navigations cause a cancellation and cleanup of already running navigations
* Wire in existing error and cancellation logic so cancellation matches previous behavior

PR Close #25740
2018-09-20 17:42:58 -07:00
Jason Aden 5d689469f6 refactor(router): create pipeable afterPreactivation function (#25740)
PR Close #25740
2018-09-20 17:42:58 -07:00
Jason Aden 855ad8804e refactor(router): create pipeable resolveData function (#25740)
PR Close #25740
2018-09-20 17:42:58 -07:00
Jason Aden 29d3f3f6dd refactor(router): create pipeable checkGuards function (#25740)
PR Close #25740
2018-09-20 17:42:58 -07:00
Jason Aden 33101359c6 refactor(router): create pipeable setupPreactivation function (#25740)
PR Close #25740
2018-09-20 17:42:58 -07:00
Jason Aden 44eef5c343 refactor(router): create pipeable beforePreactivation function (#25740)
PR Close #25740
2018-09-20 17:42:58 -07:00
Jason Aden 68b7847b4c refactor(router): create pipeable applyRedirects function (#25740)
PR Close #25740
2018-09-20 17:42:58 -07:00
Jason Aden 2b2e841e5b refactor(router): create pipeable recognize function (#25740)
PR Close #25740
2018-09-20 17:42:58 -07:00
Greg Magolan b99d7ed5bf build(bazel): update to rules_typescript 0.17.0 & rules_nodejs 0.13.4 (#25920)
PR Close #25920
2018-09-18 13:05:38 -07:00
Daniel Wiehl 8dc2b119fb fix(router): mount correct component if router outlet was not instantiated and if using a route reuse strategy (#25313) (#25314)
This unsets 'attachRef' on outlet context if no route is to be reused in route activation.

Closes #25313

PR Close #25314
2018-09-11 16:26:42 -07:00
vincecampanale f2ba55f2fb docs(router): change description of parameter usage for navigation functions (#21840)
PR Close #21840
2018-09-11 16:24:23 -07:00
Matt Keller 00d3666d95 fix(compiler): Fix look up of entryComponents in AOT Summaries (#24892)
Previously, when you attempted to bootstrap a component that had a
router-outlet using ngsummaries, it would complain that the component
was not provided by any module even if it was. This commit fixes a
mistake (AFAICT) which caused the lookup of the component in the AOT
summaries to fail.

I believe this change is safe. I've run the affected tests within Google
and there were no breakages caused by this change.

PR Close #24892
2018-09-11 16:23:17 -07:00
Trotyl 010e35d995 feat(router): warn if navigation triggered outside Angular zone (#24959)
closes #15770, closes #15946, closes #24728

PR Close #24959
2018-09-05 09:35:14 -07:00
Zhicheng Wang 8e6ce058ae docs(API): 翻译完了 ParamMap 2018-09-04 16:49:14 +08:00
Zhicheng Wang a033f25b13 docs(API): 翻译完了大部分路由器事件 2018-09-04 14:36:53 +08:00
Zhicheng Wang 0d7988992b docs(API): 翻译完了所有路由守卫 2018-09-04 14:04:10 +08:00
Zhicheng Wang 46a2608476 docs(API): 翻译完了 RouterLinkActive 2018-09-04 10:25:36 +08:00
Zhicheng Wang de47500c53 docs(API): 翻译完了 RouterOutlet 2018-09-02 11:53:17 +08:00
Zhicheng Wang 10ddb2449f docs(API): 翻译完了 RouterModule 2018-09-01 20:55:38 +08:00
Zhicheng Wang cfd6494ade docs(API): 翻译完了 Routes 2018-09-01 13:07:46 +08:00
Zhicheng Wang a6d7c47763 docs(API): 翻译完了 RouterLink 2018-09-01 10:16:58 +08:00
Zhicheng Wang f224ca6265 docs(API): 翻译完了 ActivatedRoute 2018-09-01 09:57:03 +08:00
Zhicheng Wang acfc14aafa docs(API): 翻译 router 2018-08-31 16:21:38 +08:00
Jason Aden fc89479044 fix(router): default scroll position restoration to disabled (#25586)
Fixes #25145
FW-305 #resolve

PR Close #25586
2018-08-21 10:48:14 -07:00
Marcus Krahl 07d8d3994c feat(router): add UrlSegment[] to CanLoad interface (#13127)
CanLoad now defines UrlSegment[] as a second parameter of the function.
Users can store the initial url segments and refer to them later, e.g. to go
back to the original url after authentication via router.navigate(urlSegments).
Existing code still works as before because the second function parameter
does not have to be defined.

Closes #12411

PR Close #13127
2018-08-16 16:32:18 -07:00
Anthony Humes ba1e25f53f fix(router): take base uri into account in `setUpLocationSync()` (#20244)
Normalize the full URL (including the base uri) before passing it to
`router.navigateByUrl()`.

Fixes #20061

PR Close #20244
2018-08-06 11:11:07 -07:00
Stephen Fluin 166ddaadca docs(router): clarify scroll position wording (#25077)
PR Close #25077
2018-08-01 10:53:35 -07:00
George Wilde 323faf954b docs(router): Removed unneeded trailing text. (#24894)
PR Close #24894
2018-07-26 17:01:02 -07:00
Adrien Samson 968f153491 fix(router): Fix _lastPathIndex in deeply nested empty paths (#22394)
PR Close #22394
2018-07-25 11:27:28 -07:00
Alex Rickabaugh 60aeee7abf feat(ivy): selector side of ModuleWithProviders via type metadata (#24862)
Within an @NgModule it's common to include in the imports a call to
a ModuleWithProviders function, for example RouterModule.forRoot().
The old ngc compiler was able to handle this pattern because it had
global knowledge of metadata of not only the input compilation unit
but also all dependencies.

The ngtsc compiler for Ivy doesn't have this knowledge, so the
pattern of ModuleWithProviders functions is more difficult. ngtsc
must be able to determine which module is imported via the function
in order to expand the selector scope and properly tree-shake
directives and pipes.

This commit implements a solution to this problem, by adding a type
parameter to ModuleWithProviders through which the actual module
type can be passed between compilation units.

The provider side isn't a problem because the imports are always
copied directly to the ngInjectorDef.

PR Close #24862
2018-07-20 11:48:35 -07:00
Alex Rickabaugh 8a5cd2200a fix(ivy): allow building router with ngtsc (#24862)
This commit adds the ivy-local tag to //packages/router. Since the
router depends on //packages/upgrade, it makes that package
compatible with ngtsc as well.

PR Close #24862
2018-07-20 11:48:35 -07:00
Jason Aden 328971ffcc feat(router): add urlUpdateStrategy allow updating the browser URL at the beginning of navigation (#24820)
Fixes #24616

PR Close #24820
2018-07-12 14:40:08 -04:00
sergeome 86d254d386 fix(router): add ability to recover from malformed url (#23283)
Fixes #21468

PR Close #23283
2018-07-10 18:48:52 -07:00
George Kalpakas 787c54736c test: run unit tests in random order (#19904)
PR Close #19904
2018-07-06 13:48:02 -07:00
George Kalpakas 809e8f742e test: make `NgMatchers` type-aware (#19904)
PR Close #19904
2018-07-06 13:48:02 -07:00
George Kalpakas 00c110b055 build: upgrade jasmine (and related typings) to latest version (#19904)
With these changes, the types are a little stricter now and also not
compatible with Protractor's jasmine-like syntax. So, we have to also
use `@types/jasminewd2` for e2e tests (but not for non-e2e tests).

I also had to "augment" `@types/jasminewd2`, because the latest
typings from [DefinitelyTyped][1] do not reflect the fact that the
`jasminewd2` version (v2.1.0) currently used by Protractor supports
passing a `done` callback to a spec.

[1]: 566e039485/types/jasminewd2/index.d.ts (L9-L15)

Fixes #23952
Closes #24733

PR Close #19904
2018-07-06 13:48:02 -07:00
Sarun Intaralawan b72dbc843f docs(router): add `paramsInheritanceStrategy` documentation (#22590)
PR Close #22590
2018-07-06 10:10:01 -07:00
Igor Minar e3064d5432 feat: typescript 2.9 support (#24652)
PR Close #24652
2018-07-03 13:32:06 -07:00
Rado Kirov c95437f15d build(bazel): Turning on strictPropertyInitialization for Angular. (#24572)
All errors for existing fields have been detected and suppressed with a
`!` assertion.

Issue/24571 is tracking proper clean up of those instances.

One-line change required in ivy/compilation.ts, because it appears that
the new syntax causes tsickle emitted node to no longer track their
original sourceFiles.

PR Close #24572
2018-06-25 07:57:13 -07:00
Jason Aden 5731d0741a fix(router): fix lazy loading of aux routes (#23459)
Fixes #10981

PR Close #23459
2018-06-13 11:20:20 -07:00
Victor Savkin 49c5234c68 feat(router): implement scrolling restoration service (#20030)
For documentation, see `RouterModule.scrollPositionRestoration`

Fixes #13636 #10929 #7791 #6595

PR Close #20030
2018-06-08 15:30:52 -07:00
Alex Rickabaugh 7983f0a69b ci(ivy): configure CI environments for Ivy JIT and AOT (#24309)
Two new CircleCI environments are created: test_ivy_jit and test_ivy_aot.
Both run a subset of the tests that have been marked with Bazel tags as
being appropriate for that environment.

Once all the tests pass, builds are published to the *-builds repo both
for the legacy View Engine compiled code as well as for ivy-jit and ivy-aot.

PR Close #24309
2018-06-08 13:34:27 -07:00
Jason Aden 20c463e97c feat(router): add navigation execution context info to activation hooks (#24204)
This change adds to internal API hooks (undocumented API) for
`before/afterPreactivation`. The immediate need for this API is to
allow applications to build support for marshalling navigation between
a web worker and the main application.

Fixes #24202

PR Close #24204
2018-06-05 15:15:54 -07:00
Alex Eagle 017d67cdf8 test: switch to ts_web_test_suite (#23859)
Unit tests now run on Firefox too

PR Close #23859
2018-05-15 11:40:56 -07:00
swseverance fe3679a356 style: remove empty comments (#23404)
PR Close #23404
2018-05-10 15:48:13 -07:00
Zaven Muradyan 89f64e58c3 fix(router): avoid freezing queryParams in-place (#22663)
The recognizer code used to call Object.freeze() on queryParams before
using them to construct ActivatedRoutes, with the intent being to help
avoid common invalid usage. Unfortunately, Object.freeze() works
in-place, so this was also freezing the queryParams on the actual
UrlTree object, making it more difficult to manipulate UrlTrees in
things like UrlHandlingStrategy.

This change simply shallow-copies the queryParams before freezing them.

Fixes #22617

PR Close #22663
2018-05-10 07:54:11 -07:00
Jason Aden 553a680817 fix(router): correct the segment parsing so it won't break on ampersand (#23684)
PR Close #23684
2018-05-10 07:53:53 -07:00
Igor Minar 6601d0f7ba build: update to rxjs@6.0.0 (#23679)
PR Close #23679
2018-05-03 10:53:39 -07:00
Steven Liekens 4cfa571258 fix(router): cache route handle if found (#22475)
When asking the route reuse strategy to retrieve a detached route handle, store the
return value in a local variable for further processing instead of asking again later.

resolves #22474

PR Close #22475
2018-04-23 13:35:59 -07:00
Pete Bacon Darwin 4b96a58c5a docs: remove all deprecated `@stable` jsdoc tags (#23210)
These are no longer needed as stable docs are computed as those that
do not have `@experimental` or `@deprecated` tags.

PR Close #23210
2018-04-10 21:49:32 -07:00
Pete Bacon Darwin 9141424ac6 docs(router): remove unnecessary `{@link Injector}` jsdoc tags (#23187)
Inline code blocks are automatically linked, if possible, to their API
page.

PR Close #23187
2018-04-05 09:29:08 -07:00
Pete Bacon Darwin 31b90436b4 docs(router): migrate deprecated `@whatItDoes` tags (#23187)
The first line of the description is now used as an overview.

PR Close #23187
2018-04-05 09:29:08 -07:00
Pete Bacon Darwin f66f408b04 docs(router): migrate deprecated `@howToUse` tags (#23187)
These have been converted to `@usageNotes` or included in the
`@description` tag.

PR Close #23187
2018-04-05 09:29:08 -07:00
JiaLi.Passion c560423b52 build: upgrade zone.js (#23108)
PR Close #23108
2018-04-04 08:24:02 -07:00
Steven Liekens d37064ce28 test(router): fix typo in expectation (#23137)
PR Close #23137
2018-04-04 08:22:03 -07:00
Igor Minar 92724b396b build: update to rxjs@6.0.0-rc.0 (#23106)
PR Close #23106
2018-04-03 10:00:24 -07:00
Alex Eagle 15278784fc release(bazel): change publish-next script to publish bazel artifacts (#23097)
PR Close #23097
2018-03-30 14:03:05 -07:00
Igor Minar 22cb2c9441 build: add missing dependencies on @rxjs//operators needed for rxjs@6.0.0-beta.4 (#23084)
PR Close #23084
2018-03-30 13:07:03 -07:00
Igor Minar 6f7d14064c build: update to rxjs@6.0.0-beta.4 (#23084)
PR Close #23084
2018-03-30 13:07:03 -07:00
Veres Lajos de90314304 style: typos fixed - https://github.com/vlajos/misspell-fixer (#22975)
PR Close #22975
2018-03-27 14:51:53 -04:00
Igor Minar 8768665587 fix: correct peerDependencies declaration on rxjs 2018-03-20 22:48:41 -07:00
Jason Aden 623d769858 fix(router): make locationSyncBootstrapListener public due to change in output after TS 2.7 update in #22669 (#22896)
PR Close #22896
2018-03-20 17:40:25 -07:00
Vikram Subramanian e6c731f791 fix(router): don't use spread operator to workaround an issue in closure compiler (#22884)
Closure compiler could not handle the spread operator in this one place. Working around it by removing the use of spread operator.

PR Close #22884
2018-03-20 13:30:37 -07:00
Igor Minar 7d095b96cd fix: correct several esm2015 entry-points in package.jsons (#22892)
PR Close #22892
2018-03-20 13:30:08 -07:00
Alex Eagle 689f351092 build: expose flatModuleOutFile option on ng_module (#22814)
This lets projects like Material change ng_package "bundle index" files to non-conflicting paths

Currently packages like @angular/core ship with the generated metadata
in a path like 'core.js' which overwrites one of the inputs.

Angular material puts the generated file in a path like 'index.js'

Either way these files generated by ng_module rules have the potential
to collide with inputs given by the user, which results in an error.

Instead, give users the freedom to choose a different non-conflicting name.

Also this refactors the ng_package rule, removing the redundant
secondary_entry_points attribute.

Instead, we assume that any ng_module in the deps with a module_name
attribute is a secondary entry point.

PR Close #22814
2018-03-20 13:28:57 -07:00
Igor Minar b43f8bc7d3 feat(core): upgrade rxjs to 6.0.0-alpha.4 (#22573)
PR Close #22573
2018-03-19 21:51:51 -07:00