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

When a redirect is before the thing redirects to it crashes the browser without an error message

Expected behavior

It is ok if it doesn't work, but it should produce an error.

Minimal reproduction of the problem with instructions

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { PageNotFoundComponent } from './not-found.component';
import { LoginComponent } from './login/login.component';
import { UserProfileComponent } from './user-profile/user-profile.component';

const appRoutes: Routes = [
{
path: '',
redirectTo: '/products', pathMatch: 'full'
},
{
path: 'products',
loadChildren: 'app/products/products.module#ProductsModule'
},
{
path: 'admin',
loadChildren: 'app/admin/admin.module#AdminModule'
},
{
path: 'login',
component: LoginComponent
},
{
path: 'profile',
component: UserProfileComponent
},
{ path: '404', component: PageNotFoundComponent },
{ path: '**', component: PageNotFoundComponent }
];

@NgModule({
imports: [RouterModule.forRoot(appRoutes)],
exports: [RouterModule],
providers: []
})
export class AppRoutingModule { }

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

Please tell us about your environment:

Mac OSX 10.12.3

Angular cli running localhost:4200

Atom editor

Angular version: 2.0.X

angular-cli: 1.0.0-beta.25.5

node: 6.9.5

os: darwin x64

@angular/common: 2.4.7

@angular/compiler: 2.4.7

@angular/core: 2.4.7

@angular/forms: 2.4.7

@angular/http: 2.4.7

@angular/material: 2.0.0-beta.1

@angular/platform-browser: 2.4.7

@angular/platform-browser-dynamic: 2.4.7

@angular/router: 3.4.7

@angular/compiler-cli: 2.4.7

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 Version 56.0.2924.87 (64-bit)

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

TS

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

6.9.5

Moving the redirectTo: '/products' towards the bottom fixes this problem. Which is fine, but doing it wrong should not crash the browser.

Issue 2:
I've been digging into Angular 2 and have run into a potential road block for extending certain kinds of components.

In the the following example, I have a button component, and a directive that will apply styles based on touch events. There will be many other objects other than just the button that will inherit the exact same touch behavior. I've explored my options, and I'm at a loss:

Directly extend a TouchClass. This seems less than ideal since typescript doesn't support multiple class inheritance, and I'd also like to expose the behavior to consumers for use in their own classes.

Fake multiple class inheritance through an interface. This seems like a hack and requires me to redeclare a shim api on every class I'm trying to mix into. https://www.stevefenton.co.uk/2014/02/TypeScript-Mixins-Part-One/

Create a helper function that does it through a service directly on elementRef.nativeElement in the component constructor. I really don't want to do this since it states in the docs that nativeElement will be null when running in a worker, and that capability is something I'm the most excited about.

Without getting too deep into the guts, I'd presume that the componentMetadata is available during the components compile time, and that the host property could be scanned for additional directives that could be added dynamically and compiled at the same time. This would allow you to do mixins the angular way: using composable directives to extend functionality, and doing it without breaking view projection. Short example below.

Current behavior

Declaring a directive in componentMetadata.host treats it as a regular attribute

Expected/desired behavior

The directive declared in host would be processed at compile time.

/**
* App
*/
@Component({
selector: 'app-component',
template: '<g-btn>TEST</g-btn>',
directives: [gBtn, gTouch]
})

export class AppComponent {
constructor() {

}
}

/**
* Touch Directive
* Will be used in lots and lots of components
*/
@Directive({
selector: '[g-touch]',
host: {
'(touchstart)': '...',
'(touchend)': '...',
'(touchmove)': '...',
'(touchcancel)': '...'
}
})

export class gTouch {
constructor() {

}
}

/**
* Simple button component
*/
@Component({
selector: 'g-btn',
template: '<ng-content></ng-content>',
host: {
'role': 'button',
// WOULD LOVE FOR THIS TO COMPILE THE DIRECTIVE!
// right now it just adds an attribute called g-touch
'g-touch': ' '
}
})

export class gBtn {

constructor() {

}
}

Some ideas of how this could work:

// Option 1: just scan the host properties for directives.
// This would be my ideal, simple and understandable
@Component({
selector: 'g-btn',
template: '<ng-content></ng-content>',
host: {
'role': 'button',
'g-touch': true // or {prop: 'foo'} or string
}
})

// Option 2: definitely more declarative using a hostDirectives property
// more declarative, albeit more annoying to have to reimport the touch class
@Component({
selector: 'g-btn',
template: '<ng-content></ng-content>',
hostDirectives: gTouch,
host: {
'role': 'button',
'g-touch': true
}
})

// Option 3: declare host directives as its own thing, still just
// use keys pointing to bool, obj, or string
@Component({
selector: 'g-btn',
template: '<ng-content></ng-content>',
hostDirectives: {
'g-touch': {someOption: someOption}
},
host: {
'role': 'button',
}
});

// Option 4: Not a huge fan of this one, but understandable if
// people want to keep one host property
@Component({
selector: 'g-btn',
template: '<ng-content></ng-content>',
host: {
'role': 'button',
_directives: {
'g-touch': true
}
}
});

Thanks everyone, Angular 2 is looking great!. Let me know if theres something I'm missing.