Commit Graph

143 Commits

Author SHA1 Message Date
Miško Hevery 5293794316 fix: turn on nullability in the code base. 2017-04-18 12:07:33 -07:00
Miško Hevery a0d124bd91 fix(router): relax nullability requirements 2017-04-18 12:07:33 -07:00
Miško Hevery bc431888f3 fix(router): Update types for TypeScript nullability support
This reverts commit ea8ffc9841.
2017-04-18 12:07:33 -07:00
Victor Berchet 82417b3ca5 fix(router): prevent `RouterLinkActive` from causing an infinite CD loop
fixes #15825
2017-04-17 10:15:44 -07:00
Tobias Bosch ea8ffc9841 Revert "fix(router): Update types for TypeScript nullability support"
This reverts commit 56c46d70f7.

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 0ab04bd62c refactor(router): cleanup & simplifications 2017-04-11 11:15:11 -07:00
Marc Laval 46ce3317c3
test(router): enable running the campaign in non-ES6 browsers
Closes #15806.
2017-04-10 15:43:42 -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 6d12aa978d fix(router): the preloader use the module from the loaded config 2017-04-10 16:35:47 -06:00
Ethan Veres 7b005aadc1 style(router): fix typo in router preloader method 2017-04-04 14:12:45 -06:00
Victor Berchet d58a242fe7 refactor(router): cleanup & simplification (#15436) 2017-03-29 09:44:04 -07:00
Dzmitry Shylovich 0c36f2353d perf(router): don't create new serializer every time UrlTree.toString is called (#15565) 2017-03-28 16:17:48 -07:00
Dzmitry Shylovich f368381d12 fix(router): should run CanActivate after CanDeactivate guards
Closes #14059
Closes #15467
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 8e03f65645 refactor(router): improve flatten fn
closes #15505
2017-03-28 09:39:20 -07:00
Dzmitry Shylovich 606b8fafb0 refactor(router): use object spread operator instead of merge fn 2017-03-28 09:38:58 -07:00
Ward Bell 816b389759 docs: in doc comments, replace [aA]ngular2 with Angular (#15463) 2017-03-27 09:44:35 -07:00
Dzmitry Shylovich 8785b2bf6d fix(router): shouldn't execute CanLoad when a route has been loaded
Closes #14475
Closes #15438
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 (#15387)
Fixes #15290
2017-03-23 10:43:14 -07:00
Igor Minar da700d1842 docs: move markdown docs from root dir to docs/ and remove obsolete files (#15410) 2017-03-22 22:50:12 -07:00
JB Nizet 98cb974796 docs(router): fix typo in ParamMap api doc (#15397) 2017-03-22 17:14:11 -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 a9d5de0e56 refactor(router): misc minor updates 2017-03-20 09:19:32 -07:00
Filipe Silva f634c62cb3 test: add systemjs+umd integration test (#14196)
This test ensures the `__esModule` is set on UMD bundles, thus making them compatible with SystemJS@^0.22.3.

Followup from https://github.com/frankwallis/plugin-typescript/issues/185.

PR Close #14196
2017-03-19 12:23:07 -05:00
Jason Aden 49829b4a4d build: add package names to secondary endpoint package.json files (#15253)
Fixes #14736

PR Close #15253
2017-03-17 16:52:55 -05:00
Jason Aden 410aa33005 build: fix paths to typings files so tsickle resolves imports correctly
Fixes #15080
2017-03-16 17:34:29 -07:00
Victor Berchet 029d0f25e5 fix(router): fix query parameters with multiple values (#15129)
fixes #14796
2017-03-15 15:27:19 -07:00
Victor Berchet 13686bb518 fix: element injector vs module injector (#15044)
fixes #12869
fixes #12889
fixes #13885
fixes #13870

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
Tobias Bosch 2c5a671341 fix: don't instantiate providers with ngOnDestroy eagerly. (#15070)
BREAKING CHANGE:

Perviously, any provider that had an ngOnDestroy lifecycle hook would be created eagerly.

Now, only classes that are annotated with @Component, @Directive, @Pipe, @NgModule are eager. Providers only become eager if they are either directly or transitively injected into one of the above.

This also makes all `useValue` providers eager, which
should have no observable impact other than code size.

EXPECTED IMPACT:
Making providers eager was an incorrect behavior and never documented.
Also, providers that are used by a directive / pipe / ngModule stay eager.
So the impact should be rather small.

Fixes #14552
2017-03-14 14:32:26 -07:00
Jason Aden bebedfed24 build: build modules and examples for karma 2017-03-08 17:35:20 -08:00
Jason Aden b74ab83d2c refactor: update paths from modules/@angular to packages 2017-03-08 16:29:28 -08:00
Jason Aden da8ea350b2 refactor: More generic build.sh file 2017-03-08 16:29:28 -08:00
Jason Aden 58dd4673cd refactor: remove babel config files 2017-03-08 16:29:28 -08:00
Jason Aden 72563b61fb build: fix rollup config file paths 2017-03-08 16:29:28 -08:00
Jason Aden 5aed1e36b8 refactor: move secondary entry point rollup configs. 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