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

The app works fine if built with ng build --prod.

The build with ng build --prod --aot completes successfully, but the app won't start with the following exception:

main.7c16020….bundle.js:694 EXCEPTION: Cannot read property 'replace' of undefinedt.handleError @ main.7c16020….bundle.js:694(anonymous function) @ main.7c16020….bundle.js:428t.invoke @ main.7c16020….bundle.js:1486onInvoke @ main.7c16020….bundle.js:512t.invoke @ main.7c16020….bundle.js:1486n.run @ main.7c16020….bundle.js:1486(anonymous function) @ main.7c16020….bundle.js:1486t.invokeTask @ main.7c16020….bundle.js:1486onInvokeTask @ main.7c16020….bundle.js:512t.invokeTask @ main.7c16020….bundle.js:1486n.runTask @ main.7c16020….bundle.js:1486o @ main.7c16020….bundle.js:1486

main.7c16020….bundle.js:694 ORIGINAL STACKTRACE:t.handleError @ main.7c16020….bundle.js:694(anonymous function) @ main.7c16020….bundle.js:428t.invoke @ main.7c16020….bundle.js:1486onInvoke @ main.7c16020….bundle.js:512t.invoke @ main.7c16020….bundle.js:1486n.run @ main.7c16020….bundle.js:1486(anonymous function) @ main.7c16020….bundle.js:1486t.invokeTask @ main.7c16020….bundle.js:1486onInvokeTask @ main.7c16020….bundle.js:512t.invokeTask @ main.7c16020….bundle.js:1486n.runTask @ main.7c16020….bundle.js:1486o @ main.7c16020….bundle.js:1486

main.7c16020….bundle.js:694 TypeError: Cannot read property 'replace' of undefined

at a (main.7c16020….bundle.js:610)

at new t (main.7c16020….bundle.js:617)

at e.t.renderComponent (main.7c16020….bundle.js:617)

at t.renderComponent (main.7c16020….bundle.js:71)

at e.t (main.7c16020….bundle.js:120)

at new e (main.7c16020….bundle.js:1472)

at i (main.7c16020….bundle.js:1472)

at e.createInternal (main.7c16020….bundle.js:1472)

at e.t.create (main.7c16020….bundle.js:120)

at t.create (main.7c16020….bundle.js:92)

Expected behavior

The app should start

Minimal reproduction of the problem with instructions

Get the code (2 projects) at https://github.com/Farata/angular2typescript/tree/master/chapter10/extras

Start the standalone node server,

In the auction_cli npm run build

Open the browser at localhost:8000. The app works

Add --aot to the build script

In the auction_cli npm run build

Open the browser at localhost:8000. The app gives the above exception

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

Please tell us about your environment:

OS X, NodeJS server

Angular version: 2.1.0

Browser: [all ]

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

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

Issue 2:
Steps to reproduce and a minimal demo of the problem

demo http://plnkr.co/edit/7uoVecfa62i8No8GtQHI?p=preview

Angular2 beta 16 or higher - When I hide first section with nested components using *ngIf, ngOnDestroy of every nested component is triggered - this is OK.

<div *ngIf="!ff2">
<my-component
></my-component>
<my-component
></my-component>
<my-component
></my-component>
<my-component
></my-component>
<my-component
></my-component>
</div>

Outpu in console is

init
init
init
init
init
destroy
destroy
destroy
destroy
destroy

But when I hide second section where subcomponents are duplicated by *ngFor, not every ngOnDestroy is triggered.

<div *ngIf="!ff">
<my-component
*ngFor="#i of [1,2,3,4,5,6]"
></my-component>
</div>

output in console is

(6) init
(3) destroy

Current behavior

not every ngOnDestroy is triggered

Expected/desired behavior

every ngOnDestroy should be triggered

Other information

in angular2 beta 9 it was working correctly

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