133 Commits

Author SHA1 Message Date
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
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
Victor Savkin
5df998d086 fix(router): do not finish bootstrap until all the routes are resolved (#14762)
DEPRECATION:

Use `RouterModule.forRoot(routes, {initialNavigation: 'enabled'})` instead of
`RouterModule.forRoot(routes, {initialNavigtaion: true})`.

Before doing this, move the initialization logic affecting the router
from the bootstrapped component to the boostrapped module.

Similarly, use `RouterModule.forRoot(routes, {initialNavigation: 'disabled'})`
instead of `RouterModule.forRoot(routes, {initialNavigation: false})`.

Deprecated options: 'legacy_enabled', `true` (same as 'legacy_enabled'),
'legacy_disabled', `false` (same as 'legacy_disabled').

The "Router Initial Navigation" design document covers this change.
Read more here:
https://docs.google.com/document/d/1Hlw1fPaVs-PCj5KPeJRKhrQGAvFOxdvTlwAcnZosu5A/edit?usp=sharing
2017-03-07 14:27:20 -08:00
Victor Berchet
41da5998cd feat(router): add an option to rerun guards and resolvers when query changes (#14624)
Closes #14514
Closes #14567
2017-02-23 22:12:30 -08:00
Jason Aden
de795ea233 perf: distrubute smaller bundled code and include es2015 bundle
TypeScript compiler will now build to ES2015 code and modules. Babili is used to minify ES2015
code, providing an initial optimization that we couldn't previously get just from Uglify. Uses
Babel to convert ES2015 to UMD/ES5 code, and Uglify to minimize the output.
2017-02-21 20:48:55 -08:00
Victor Berchet
c2d5f203a5 Revert "feat(router): add an option to rerun guards and resolvers when query changes"
This reverts commit c2e0f71a78368482be4b86a60c773cc9385ad190.
2017-02-20 19:48:43 -08:00
vsavkin
c2e0f71a78 feat(router): add an option to rerun guards and resolvers when query changes
Closes #14514
Closes #14567
2017-02-20 18:01:51 -08:00
Victor Berchet
78e8814103 feat(router): add RouteConfigLoadStart and RouteConfigLoadEnd events 2017-02-20 16:19:05 -08:00
Dzmitry Shylovich
7df6f46c1c feat(router): introduce RouteConfigLoaded event
Closes #14036
2017-02-20 16:19:05 -08:00
Chuck Jazdzewski
724ca373e7 build: produce metadata bundles for @angular modules (#14509)
Closes #14509
2017-02-16 08:15:30 -08:00
Alex Eagle
7a4c25535d build: update public API with readonly (#13294)
PR Close #13294
2017-02-08 11:32:47 -06:00
Miško Hevery
69a4bb0bcd doc: standardize deprecation of preserveQueryParams (4.0 only) (#14236)
PR closes #14236
2017-02-01 16:48:19 -08:00
evan Liu
c87c3bec93 feat(router): deprecate preserveQueryParams,add queryParamsHandling (#14095)
PR Close #14095
2017-01-31 15:43:25 -06:00
Dzmitry Shylovich
635bf02b02 fix(router): enable loadChildren with function in aot (#13909)
Closes #11075
2017-01-18 15:56:34 -08:00
Dzmitry Shylovich
e8ea741039 fix(router): routerLinkActive should not throw when not initialized (#13273)
Fixes #13270

PR Close #13273
2017-01-17 18:38:45 -06:00
Dzmitry Shylovich
1a92e3d406 refactor(router): clean up RouterLinkActive (#13273)
PR Close #13273
2017-01-17 18:37:34 -06:00
Miško Hevery
d169c2434e feat(core): Add type information to injector.get() (#13785)
- Introduce `InjectionToken<T>` which is a parameterized and type-safe
  version of `OpaqueToken`.

DEPRECATION:
- `OpaqueToken` is now deprecated, use `InjectionToken<T>` instead.
- `Injector.get(token: any, notFoundValue?: any): any` is now deprecated
  use the same method which is now overloaded as
  `Injector.get<T>(token: Type<T>|InjectionToken<T>, notFoundValue?: T): T;`.

Migration
- Replace `OpaqueToken` with `InjectionToken<?>` and parameterize it.
- Migrate your code to only use `Type<?>` or `InjectionToken<?>` as
  injection tokens. Using other tokens will not be supported in the
  future.

BREAKING CHANGE:
- Because `injector.get()` is now parameterize it is possible that code
  which used to work no longer type checks. Example would be if one
  injects `Foo` but configures it as `{provide: Foo, useClass: MockFoo}`.
  The injection instance will be that of `MockFoo` but the type will be
  `Foo` instead of `any` as in the past. This means that it was possible
  to call a method on `MockFoo` in the past which now will fail type
  check. See this example:

```
class Foo {}
class MockFoo extends Foo {
  setupMock();
}

var PROVIDERS = [
  {provide: Foo, useClass: MockFoo}
];

...

function myTest(injector: Injector) {
  var foo = injector.get(Foo);
  // This line used to work since `foo` used to be `any` before this
  // change, it will now be `Foo`, and `Foo` does not have `setUpMock()`.
  // The fix is to downcast: `injector.get(Foo) as MockFoo`.
  foo.setUpMock();
}
```

PR Close #13785
2017-01-17 15:34:54 -06:00
Dzmitry Shylovich
69fa3bbc03 feat(router): add an extra argument to CanDeactivate interface (#13560)
Adds a `nextState` argument to access the future url from `CanDeactivate`.

BEFORE:

    canDeactivate(component: T, route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean>|Promise<boolean>|boolean;

AFTER:

    canDeactivate(component: T, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): Observable<boolean>|Promise<boolean>|boolean;

Closes #9853
2016-12-27 14:08:06 -08:00
Dzmitry Shylovich
a006c1418a feat(router): routerLink add tabindex attribute (#13094)
Fixes #10895
2016-12-09 15:38:50 -08:00
Victor Berchet
b5c4bf1c59 refactor(router): misc refactoring (#13330) 2016-12-09 10:44:46 -08:00
Jónatan Núñez
9591a08dfb fix(router): Use T type in Resolve interface (#13242) 2016-12-08 11:24:38 -08:00
Dzmitry Shylovich
2893c2c0a2 fix(router): validate nested routes (#13224)
Fixes #12827
2016-12-06 10:41:01 -08:00
Victor Berchet
349ad75de3 fix(router): fix replaceUrl on RouterLink directives 2016-12-05 10:54:10 -08:00
Victor Savkin
e628b66cca feat(build): record angular version in the dom (#13164) 2016-11-30 13:52:08 -08:00
vsavkin
42cf06fa12 feat(router): add support for custom route reuse strategies 2016-11-29 23:21:41 -08:00
Dzmitry Shylovich
46d150266b feat(router_link): add skipLocationChange and replaceUrl inputs (#12850) 2016-11-14 18:30:13 -08:00
Victor Savkin
52be848f94 fix(router): incorrect injector is used when instantiating components loaded lazily (#12817) 2016-11-11 17:12:00 -08:00
vsavkin
73407351e7 feat(router): add support for custom url matchers
Closes #12442
Closes #12772
2016-11-09 16:24:58 -08:00
Victor Savkin
6e35d13fbc feat(router): add a provider making angular1/angular2 integration easier (#12769) 2016-11-09 13:33:33 -08:00
vsavkin
d509ee078b fix(router): reset URL to the stable state when a navigation gets canceled
Closes #10321
2016-11-02 12:25:23 -07:00
Jeremy Elbourn
c9f58cf78c feat(router): export routerLinkActive w/ isActive property 2016-10-26 14:08:22 -07:00
Victor Savkin
8b9ab44eee feat(router): add support for ng1/ng2 migration (#12160) 2016-10-20 10:44:44 -07:00
vsavkin
676bb0fa7d feat(router): update dts files 2016-09-20 14:53:52 -07:00
vsavkin
0614c8c99d chore(router): update publicapi 2016-09-12 10:02:48 -07:00
vsavkin
c74a438f0c docs(router): fix up the exampesd 2016-08-30 20:37:35 -07:00
Miško Hevery
979657989b fix(packages): use ES modules for primary build (#11120) 2016-08-30 18:07:40 -07:00
vsavkin
a2deafc50f fix(router): add an option to disable initial navigation 2016-08-26 10:32:35 -07:00
vsavkin
2fc5c57b31 feat(router): add support for custom error handlers 2016-08-26 10:32:35 -07:00
Igor Minar
3aaf064d11 refactor(router): remove ROUTER_DIRECTIVES which were replaced by RouterModule 2016-08-25 13:29:03 -07:00
Victor Savkin
f1ce7607a6 fix(router): canLoad should cancel a navigation instead of failing it (#11001) 2016-08-24 10:20:44 -07:00
Alex Rickabaugh
5ddecb18a7 feat(router): throw a helpful error when misusing forRoot() from a lazy module. (#10996) 2016-08-23 11:57:58 -07:00
Victor Savkin
00e157dc3b refactor(router): update stability labels (#10902) 2016-08-17 15:35:30 -07:00
Victor Savkin
24e280a21a refactor(router): remove deprecated apis (#10658) 2016-08-16 13:40:28 -07:00
Victor Savkin
6b26102931 feat(router): extend support for lazy loading children (#10705) 2016-08-15 21:11:09 -07:00
Rob Wormald
73c0a9daaf fix(router): make routerLinkActiveOptions public (#10758) 2016-08-15 00:39:59 -07:00
Victor Savkin
04c6b2fe85 fix(router): location changes and redirects break the back button (#10742) 2016-08-12 14:30:51 -07:00
vsavkin
947f9c3f56 feat(router): make router.config public 2016-08-11 22:56:10 -07:00
Miško Hevery
b96869afd2 refactor(Type): merge Type and ConcreType<?> into Type<?> (#10616)
Closes #9729

BREAKING CHANGE:

`Type` is now `Type<T>` which means that in most cases you have to
use `Type<any>` in place of `Type`.

We don't expect that any user applications use the `Type` type.
2016-08-10 18:21:28 -07:00
vsavkin
a415613457 fix(router): update dts files 2016-08-08 09:15:59 -07:00