49 Commits

Author SHA1 Message Date
Jason Aden
8f7915022c feat(router): add ActivationStart/End events 2017-09-08 13:24:26 -04:00
Jason Aden
66f0ab0371 fix(router): adjust ChildActivation events to only fire when the child is actually changing ()
* The problem was with the `fireChildActivationStart` function. It was taking a `path` param, which was an
array of `ActivatedRouteSnapshot`s. The function was being fired for each piece of the route that was being
activated. This resulted in far too many `ChildActivationStart` events being fired, and being fired on routes
that weren't actually getting activated. This change fires the event only for those routes that are actually
being activated.

fixes 

PR Close 
2017-09-05 15:46:29 -05:00
Jason Aden
dce36751f5 refactor(router): remove RouteEvent base class ()
* Introduced with , `RouteEvents` don't actually have a common constructor. Reverting here to be able to add new functionality to ChildActivation events.

PR Close 
2017-09-05 15:46:29 -05:00
Miško Hevery
a80ecf6a77 Revert "refactor(router): remove deprecated initialNavigation options ()"
This reverts commit d76761bf0136e03dd998e614f0ddd74393bd6332.
2017-08-22 18:39:06 -05:00
Olivier Combe
d76761bf01 refactor(router): remove deprecated initialNavigation options ()
BREAKING CHANGE: the values `true`, `false`, `legacy_enabled` and `legacy_disabled` for the router parameter `initialNavigation` have been removed as they were deprecated. Use `enabled` or `disabled` instead.

PR Close 
2017-08-22 16:53:00 -05:00
Chuck Jazdzewski
3a227a1f6f refactor(router): compile router cleanly with TypeScript 2.4 () 2017-08-02 17:32:02 -07:00
Jason Aden
49cd8513e4 feat(router): add events tracking activation of individual routes
* Adds `ChildActivationStart` and `ChildActivationEnd`
* Adds test to verify the PreActivation phase of routing
2017-08-01 10:44:00 -07:00
Victor Berchet
9479a106bb build: enable TSLint on the packages folder 2017-07-31 15:47:57 -07:00
Miško Hevery
a7f2468184 Revert "fix(router): should throw when lazy loaded module doesn't define any routes ()"
This reverts commit 82923a381d96a7078d8b422e4ce6949e6c14950c.
2017-07-27 10:53:01 -07:00
Dzmitry Shylovich
086f4aa72c fix(router): child CanActivate guard should wait for parent to complete ()
Closes 

PR Close 
2017-07-26 17:11:22 -05:00
Dzmitry Shylovich
82923a381d fix(router): should throw when lazy loaded module doesn't define any routes ()
Closes 

PR Close 
2017-07-26 17:11:07 -05:00
Lars Gyrup Brink Nielsen
c67bad4f43 docs(router): minor typo ()
Fix a minor typo in the description of a router spec.
2017-07-20 09:32:34 -07:00
Sam Verschueren
b399cb26d9 fix(router): terminal route in custom matcher 2017-07-18 10:25:18 -07:00
Roy Ling
e20cfe1bbc fix(router): canDeactivate guards should run from bottom to top
Closes .
2017-07-18 10:04:39 -07:00
Dzmitry Shylovich
eb6fb5f87e fix(router): should navigate to the same url when config changes
Closes 
2017-07-18 10:04:11 -07:00
Dzmitry Shylovich
ad3029e786 fix(router): should run resolvers for the same route concurrently
Fixes 
2017-07-18 10:03:33 -07:00
Victor Berchet
c723d42d0a refactor: fix typos () 2017-07-07 16:55:17 -07:00
Jason Aden
ae27af7399 fix(router): encode URLs the same way AngularJS did (closer to spec) ()
fixes 
2017-07-06 17:10:25 -07:00
Jason Aden
8a1a989a1c feat(router): add router-level events for GuardsCheck and Resolve () 2017-07-01 10:30:17 -07:00
Victor Berchet
5d4f5434fd refactor(router): don't run the change detection every time an outlet is activated
fix(router): inside on push // SQUASH after review
2017-05-19 11:55:15 -07:00
Victor Berchet
81ca51a8f0 refactor(router): cleanup, simplification 2017-05-19 11:55:15 -07:00
Matias Niemelä
86b7bd9c8e revert: refactor(router): cleanup, simplification
This reverts commit 44d48d9d7aa10bbf03c412ce7e59821c748b5d2d.
2017-05-18 11:57:22 -07:00
Matias Niemelä
a0a6029915 revert: refactor(router): don't run the change detection every time an outlet is activated
This reverts commit 198edb31093ffdecfd13aed17967fb02e650cffe.
2017-05-18 11:57:22 -07:00
Victor Berchet
198edb3109 refactor(router): don't run the change detection every time an outlet is activated 2017-05-17 19:32:04 -07:00
Victor Berchet
44d48d9d7a refactor(router): cleanup, simplification 2017-05-17 19:32:04 -07:00
Tobias Bosch
ce1d7c4a6e refactor: use view engine also for NgModuleFactorys ()
* refactor(core): provide error message in stack for reflective DI

Fixes 

* fix(compiler): make AOT work with `noUnusedParameters`

Fixes 

* refactor: use view engine also for `NgModuleFactory`s

This is a prerequisite for being able to mock providers
in AOTed code later on.
2017-05-11 10:26:02 -07:00
Victor Berchet
5d4b36f80f fix(router): fix redirect to a URL with a param having multiple values ()
fixes 

PR Close 
2017-05-08 17:50:33 -05:00
Victor Berchet
415a0f8047 test(router): simplify redirect tests () 2017-05-08 17:50:29 -05:00
Miško Hevery
5293794316 fix: turn on nullability in the code base. 2017-04-18 12:07:33 -07:00
Miško Hevery
bc431888f3 fix(router): Update types for TypeScript nullability support
This reverts commit ea8ffc984136ef4d32b6858fe35e69cc9fced021.
2017-04-18 12:07:33 -07:00
Victor Berchet
82417b3ca5 fix(router): prevent RouterLinkActive from causing an infinite CD loop
fixes 
2017-04-17 10:15:44 -07:00
Tobias Bosch
ea8ffc9841 Revert "fix(router): Update types for TypeScript nullability support"
This reverts commit 56c46d70f7b3cb308d658224682d739d4f9b5a2a.

Broke in G3.
2017-04-17 09:56:09 -07:00
Miško Hevery
56c46d70f7 fix(router): Update types for TypeScript nullability support 2017-04-14 14:31:17 -07:00
Victor Berchet
ea4afebeb9 refactor(router): drop the InternalRoute interface 2017-04-14 09:08:13 -07:00
Dzmitry Shylovich
886cca028f refactor(router): misc refactoring 2017-04-14 09:08:13 -07:00
Victor Berchet
a487563768 fix(router): fix query param parsing 2017-04-11 11:15:11 -07:00
Victor Berchet
83527fd4fb test(router): test preloading when a module is already loaded 2017-04-10 16:35:47 -06:00
Dzmitry Shylovich
f368381d12 fix(router): should run CanActivate after CanDeactivate guards
Closes 
Closes 
2017-03-28 15:51:33 -07:00
Dzmitry Shylovich
7c2f795ea6 refactor(router): fix tests structure 2017-03-28 15:51:17 -07:00
Dzmitry Shylovich
8785b2bf6d fix(router): shouldn't execute CanLoad when a route has been loaded
Closes 
Closes 
2017-03-24 14:38:38 -07:00
Dzmitry Shylovich
fb1be83a1b refactor(router): polishing 2017-03-24 14:38:23 -07:00
Dzmitry Shylovich
08f2f08d74 fix(router): should pass new data to Observable when query params change ()
Fixes 
2017-03-23 10:43:14 -07:00
Victor Berchet
d3eda7a5b5 feat(router): add ParamMap.keys to get a list of parameters 2017-03-20 09:19:32 -07:00
Victor Berchet
a755b715ed feat(router): introduce ParamMap to access parameters
The Router use the type `Params` for all of:
- position parameters,
- matrix parameters,
- query parameters.

`Params` is defined as follow `type Params = {[key: string]: any}`

Because parameters can either have single or multiple values, the type should
actually be `type Params = {[key: string]: string | string[]}`.

The client code often assumes that parameters have single values, as in the
following exemple:

```
class MyComponent {
sessionId: Observable<string>;

constructor(private route: ActivatedRoute) {}

ngOnInit() {
    this.sessionId = this.route
      .queryParams
      .map(params => params['session_id'] || 'None');
}
}

```

The problem here is that `params['session_id']` could be `string` or `string[]`
but the error is not caught at build time because of the `any` type.

Fixing the type as describe above would break the build because `sessionId`
would becomes an `Observable<string | string[]>`.

However the client code knows if it expects a single or multiple values. By
using the new `ParamMap` interface the user code can decide when it needs a
single value (calling `ParamMap.get(): string`) or multiple values (calling
`ParamMap.getAll(): string[]`).

The above exemple should be rewritten as:

```
class MyComponent {
sessionId: Observable<string>;

constructor(private route: ActivatedRoute) {}

ngOnInit() {
    this.sessionId = this.route
      .queryParamMap
      .map(paramMap => paramMap.get('session_id') || 'None');
}
}

```

Added APIs:
- `interface ParamMap`,
- `ActivatedRoute.paramMap: ParamMap`,
- `ActivatedRoute.queryParamMap: ParamMap`,
- `ActivatedRouteSnapshot.paramMap: ParamMap`,
- `ActivatedRouteSnapshot.queryParamMap: ParamMap`,
- `UrlSegment.parameterMap: ParamMap`
2017-03-20 09:19:32 -07:00
Victor Berchet
029d0f25e5 fix(router): fix query parameters with multiple values ()
fixes 
2017-03-15 15:27:19 -07:00
Victor Berchet
13686bb518 fix: element injector vs module injector ()
fixes 
fixes 
fixes 
fixes 

Before this change there was a single injector tree.
Now we have 2 injector trees, one for the modules and one for the components.
This fixes lazy loading modules.

See the design docs for details:
https://docs.google.com/document/d/1OEUIwc-s69l1o97K0wBd_-Lth5BBxir1KuCRWklTlI4

BREAKING CHANGES

`ComponentFactory.create()` takes an extra optional `NgModuleRef` parameter.
No change should be required in user code as the correct module will be used
when none is provided

DEPRECATIONS

The following methods were used internally and are no more required:
- `RouterOutlet.locationFactoryResolver`
- `RouterOutlet.locationInjector`
2017-03-14 16:26:17 -07:00
Jason Aden
b74ab83d2c refactor: update paths from modules/@angular to packages 2017-03-08 16:29:28 -08:00
Jason Aden
8573e36574 build: fix file paths after moving modules/@angular/* to packages/* 2017-03-08 16:29:28 -08:00
Jason Aden
3e51a19983 refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00