Commit Graph

261 Commits

Author SHA1 Message Date
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
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