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

After being blocked by a CanDeactivate guard, if the user clicks the browser back arrow:

-the url will change

-the router does NOT attempt to navigate (so doesn't seem to run through the guard)

Maybe related to 12851?

Expected behavior

On clicking the back button, we run through the guard code like normal

Minimal reproduction of the problem with instructions

http://plnkr.co/edit/DZwn4C0F8HpAjr04a5Ji?p=preview

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

We should always warn the user when they try to navigate away from unsaved changes, and certainly don't want to have the url become disconnected from what is on screen.

Please tell us about your environment:

Windows 10, VS2015 and VSCode, SystemJS

Angular version: 2.0.X

2.4.8

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

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

N/A

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

[X] feature request / proposal

I've been reading about NgModule and I want to lay out some use cases that I'm not entirely sure the current proposal (https://docs.google.com/document/d/1isijHlib4fnukj-UxX5X1eWdUar6UkiGKPDFlOuNy1U/pub) takes into consideration.

Context

I'm part of a team building an Enterprise Framework (based on Angular 2). This framework will then be the base for other apps within the same ecosystem.

We have divided the framework into smaller projects/modules (think of them as separated npm packages). These modules are sets of controls (that are then reused across other modules) or pages that use those controls.

Example

A quick example can be:

Controls Module

import {Component} from "@angular/core";

@Component({
selector: "my-combobox",
...
})
export class MyComboBox{

}

Checklist Module

// Checklist module depends on Controls module. Controls is treated as a 3rd party module.

import {Component} from "@angular/core";
import {MyComboBox} from "controlsmodule/components/mycombobox";
// Please note that we are only loading a specific component within the module, not all components inside that module.

@Component({
selector: "my-checklist-page",
directives: [MyComboBox, ...],
...
})
export class ChecklistPage{

}

Bootstrap doesn't know both Controls and Checklist modules. They are lazy loaded depending user's interaction. In this case, if the user navigates to a Checklist, the ChecklistPage component will be loaded and then the MyComboBox will also follow (because of the import made by ChecklistPage)

Checklist module has other dozen components. Each depending on other dozen components from multiple modules.

It's impractical (not to say nearly impossible) to have all components imported into the NgModule declaration. We are talking of several hundreds of components that might be used during app run time.

Also, the application needs to be modular and lazy load when possible. Different interactions within the app will lead to completely different modules being loaded.

Expected/desired behavior

The current solution, with component scoped directives, works like a charm for this use case. Not sure how this will play out with NgModule.

More than that, currently we can clearly see the dependencies needed by each component (in this case ChecklistPage). Making maintenance that much more easy.

Having all needed components imported into a NgModule, and then using them indistinctly on several components seems a fantastic solution for small applications. I feel that on a long term development, with several iterations across multiple years, with team rotation, ... having each component explicitly state on what it depends without looking into the template (and having compilation errors when something is missing) is a great advantage.

Conclusion

Please let me know if I was clear in my explanation. The goal of this issue is to raise awareness about this situation and get feedback from you on how to proceed.

We are available to show you our current work, we have several hundred Angular 2 components across 8 projects developed in the last year (since alpha 27).