Issue 1:
Normalize string / No interpolation

Replace interpolate1 = "" "${componentName0 == null ? "" : componentName0}" "" with interpolate1 = " " + stringify(componentName0) + " "; NOTE: will require import of stringify method. I think ${} creates extra unneeded checks, so simple string concat + should be better in this case.

Inline assignments

take advantage of multiple assignments per line.

``` Dart``

_componentName0 = _gen.ChangeDetectionUtil.uninitialized();

_interpolate1 = _gen.ChangeDetectionUtil.uninitialized();

_directive_1_0 = _gen.ChangeDetectionUtil.uninitialized();

_directive_2_0 = _gen.ChangeDetectionUtil.uninitialized();

becomes:

``` Dart
_componentName0 = _interpolate1 = _directive_1_0 = _directive_2_0
= _gen.ChangeDetectionUtil.uninitialized;

Also call dehydrateDirectives() from constructor so that we don't have to duplicate the code in the constructor.

Inline assignments and usages

inline where ever possible.

_dispatcher.notifyOnBinding(currentProto.bindingRecord, interpolate1);
_interpolate1 = interpolate1;

becomes

_dispatcher.notifyOnBinding(currentProto.bindingRecord, _interpolate1 = interpolate1);

have notifyOnBinding helper

create viewSet in super. Notice that _dispatcher is always a View. This code is no longer abstract so we should use concrete names.

currentProto = _protos[1]
...
change_interpolate1 = true;
_dispatcher.notifyOnBinding(currentProto.bindingRecord, interpolate1);
_interpolate1 = interpolate1;

becomes

change_interpolate1 = viewSet(1, _interpolate1 = interpolate1);

which requires this method on superclass

boolean viewSet(int index, dynamic value) {
_view.notifyOnBinding(protos[index].bindingRecord, value);
return true;
}

looseNotIdentical

have loseNotIdentical which will allow us to change if (!_gen.looseIdentical(...)) to if (_gen.looseNotIdentical(...)). (its only one char, but it is everywhere)

inline context assignment

var context = null;
context = _context;

should be

var context = _context;

Unused change_context

the code is never used in output

var change_context = false;

but is never read.

change uninitialized() method call to uninitialized static field

should save some chars

Issue 2:
I'm submitting a ...

[X] bug report

Current behavior

I have some routes like:

const routes = [
{ path: "", component: HomeComponent, pathMatch: "full" },
{ path: "profile", component: ProfileComponent },
{ path: "menu", component: MenuComponent, outlet: "sidebar" },
];

When the route http://localhost/(sidebar:menu) is open, then I'm able to remove the named outlet and go to http://localhost/ by clicking an anchor like the following:

<a [routerLink]="['', {outlets: {sidebar: null}}]">
Close
</a>

What doesn't work is navigating away from the sidebar and also going to another route like http://localhost/profile.

<a [routerLink]="['/profile', {outlets: {sidebar: null}}]">
Close
</a>

The link that is rendered is http://localhost:3971/profile(sidebar:menu)

Expected behavior

The link that should be rendered is http://localhost:3971/profile.

Repro

https://github.com/tinchou/router-repro

Please tell us about your environment:

Windows 10, Visual Studio 2017

Angular version: 2.3.1 (didn't work with 2.1.0 either)

Browser: all

Language: TypeScript 2.0.10