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

If a dependency (e.g. ServiceA) is injected into a guard (e.g. GuardA; service, that implements CanActivate interface), in a feature module (e.g. FeatureModule), that is lazy loaded, and both ServiceA and GuardA are defined in that FeatureModule, than GuardA gets it's own dedicated version of the ServiceA, whereas other components and services, defined at the feature module get their own version of the ServiceA, that is shared among them. Basically injected service isn't a singleton anymore. I think it's related to how the RouterModule works with DI.

Expected behavior

All guards, services and components of a feature module, get the same service instance, that is injected into them. So in the provided plunker theFeatureService should be created only once.

Minimal reproduction of the problem with instructions

Here is a plunker https://plnkr.co/cYjMbvgJEciKg00GSNfb

When the Feature link is clicked, then FeatureModule is lazy loaded. FeatureComponent is displayed and it contains a template with a random number, that is provided by an injected FeatureService. When Feature child link is clicked, FeatureChildGuard gets activated and a alert box with a value, that is provided by the FeatureService is provided and it differs from the one, that is displayed in the FeatureComponent, because dedicated FeatureService is created for that guard (you can also see it in console.log calls).

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

Each feature module is assumed to be an isolated and self-contained piece of program logic, so everything, that is defined in this module, that is intended to be singleton should be it. And CanActivate logic can be related to a current state of a feature module service and not only the ones, that are defined at the top-most level of angular app.

Please tell us about your environment: OS X Sierra 10.12.1, WebStorm 2016.3.3, node 6.9.1, angular-cli 1.0.0-beta.25.5 (but I guess this information is not important, as it's reproducible in browser)

Angular version: 2.4.5

Browser: all

Language: TypeScript 2.0

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 =