Issue 1:
I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

In a lazy loaded module, I use a route resolver that uses a service provided at the module level. The resolve creates a new instance of that service. Before angular 2.2.x, it wasn't creating a new instance.

Expected behavior

Reuse the same service instance provided by the lazy module in the resolve.

It shouldn't create a new instance of the service just like in angular 2.1.x

Minimal reproduction of the problem with instructions

Both are the same exact plnkr, using different angular versions.

NOT WORKING AS EXPECTED HERE: See plnkr using angular > 2.1 : http://plnkr.co/edit/kel9mq1CNR7Soaq3rNpH?p=preview

WORKING AS EXPECTED HERE: See plnkr using angular 2.1.0 : http://plnkr.co/edit/BU4AdonFYViRZyKDHj1T?p=preview

What is the motivation / use case for changing the behavior?

If data is stored in the service, it's not accessible within the resolve. OR if you store data from the resolve, it won't be accessible in components because it is not the same service instance.

Please tell us about your environment:

angular-cli: 1.0.0-beta.22-1

node: 4.5.0

os: linux x64

Angular version: 2.0.X

It is a new issue.

Issue since Angular 2.2.x

Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

Chrome

Language: [all | TypeScript X.X | ES6/7 | ES5]

TypeScript

Issue 2:
I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

After upgrading to router 3.2.0, services being provided by component module are being instantiated twice. Once while resolver is being run (last place in router is PreActivation.prototype.getToken) and then again later during activation (last place in router is RouterOutlet.prototype.activate).

Upgrading rest of Angular to 2.2.0 and leaving router at 3.1.1 it works as it used to (and looking in debugger I see service is only instantiated from PreActivation.prototype.getToken)

Expected behavior

Providers should only be instantiated once - as they are when using router version 3.1.1

Minimal reproduction of the problem with instructions

Haven't yet reproduced in a plnkr but my use case has a lazy loaded component that itself has sub components (not lazy loaded). The sub component has a resolver that uses a service, and the sub component itself uses the service. The service is included in the lazy loaded components module providers list and is being instantiated twice. Once apparently while router is working on resolve and once when component is being activated.

What is the motivation / use case for changing the behavior?

Its just wrong, and my service fetches data on initialization so extra instance causes extra fetch. This does not happen with router 3.1.1 (never tried 3.1.2 as deactivate guards don't work correctly in that version)

Please tell us about your environment:

Windows 10, Visual Studio Code, angular-cli: 1.0.0-beta.19-3 ng serve

Angular version: 2.0.X

2.2.0

Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

Only tried in Chrome

Language: [all | TypeScript X.X | ES6/7 | ES5]

Typescript 2.0.9

Node (for AoT issues): node --version =