opened
ignaciodm
username_0
**I'm submitting a ...** 
```
[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**
<!-- Describe how the bug manifests. -->
When trying to initialize a hybrid app with angular 1.5 and angular 4 and ES6 (no Typescript), it fails with: 
Error: Unexpected value 'class1' imported by the module 'DynamicNgUpgradeModule'. Please add a @NgModule annotation.

**Expected behavior**
<!-- Describe what the behavior would be without the bug. -->

To not fail the upgrade module bootstrapping 

**Minimal reproduction of the problem with instructions**
<!--
If the current behavior is a bug or you can illustrate your feature request better with an example, 
please provide the *STEPS TO REPRODUCE* and if possible a *MINIMAL DEMO* of the problem via
https://plnkr.co or similar (you can use this template as a starting point: http://plnkr.co/edit/tpl:AvJOMERrnz94ekVua0u5).
-->

import { BrowserModule } from '@angular/platform-browser';
import { ConstraintsResultsTableComponent } from './constraints/results_table.component';

After wrapping with  ng.core.NgModule wrapping
```
let AppModule = ng.core.NgModule({
    imports: [ BrowserModule ],
    declarations: [ ConstraintsResultsTableComponent ]
    })
    .Class({
        constructor: function() {}
    });

export { AppModule }
```
it throws 

```
assets/@angular/upgrade/bundles/upgrade.umd.js:145 Error: Unexpected value 'class1' imported by the module 'DynamicNgUpgradeModule'. Please add a @NgModule annotation.
    at syntaxError (http://localhost:3000/assets/@angular/compiler/bundles/compiler.umd.js:1514:34) [angular]
    at eval (http://localhost:3000/assets/@angular/compiler/bundles/compiler.umd.js:14408:44) [angular]
    at Array.forEach (native) [angular]
    at CompileMetadataResolver.getNgModuleMetadata (http://localhost:3000/assets/@angular/compiler/bundles/compiler.umd.js:14391:49) [angular]
    at JitCompiler._loadModules (http://localhost:3000/assets/@angular/compiler/bundles/compiler.umd.js:25572:64) [angular]
    at JitCompiler._compileModuleAndComponents (http://localhost:3000/assets/@angular/compiler/bundles/compiler.umd.js:25531:52) [angular]
    at JitCompiler.compileModuleAsync (http://localhost:3000/assets/@angular/compiler/bundles/compiler.umd.js:25493:21) [angular]
    at PlatformRef_._bootstrapModuleWithZone (http://localhost:3000/assets/@angular/core/bundles/core.umd.js:4794:25) [angular]
    at eval (http://localhost:3000/assets/@angular/upgrade/bundles/upgrade.umd.js:1615:26) [angular]
    at Object.onInvoke (http://localhost:3000/assets/@angular/core/bundles/core.umd.js:4133:37) [angular]
    at http://localhost:3000/assets/zone.js/dist/zone.js:759:57 [angular] "Error: Unexpected value 'class1' imported by the module 'DynamicNgUpgradeModule'. Please add a @NgModule annotation.
    at syntaxError (http://localhost:3000/assets/@angular/compiler/bundles/compiler.umd.js:1514:34) [angular]
    at eval (http://localhost:3000/assets/@angular/compiler/bundles/compiler.umd.js:14408:44) [angular]
    at Array.forEach (native) [angular]
    at CompileMetadataResolver.getNgModuleMetadata (http://localhost:3000/assets/@angular/compiler/bundles/compiler.umd.js:14391:49) [angular]
    at JitCompiler._loadModules (http://localhost:3000/assets/@angular/compiler/bundles/compiler.umd.js:25572:64) [angular]
    at JitCompiler._compileModuleAndComponents (http://localhost:3000/assets/@angular/compiler/bundles/compiler.umd.js:25531:52) [angular]
    at JitCompiler.compileModuleAsync (http://localhost:3000/assets/@angular/compiler/bundles/compiler.umd.js:25493:21) [angular]
    at PlatformRef_._bootstrapModuleWithZone (http://localhost:3000/assets/@angular/core/bundles/core.umd.js:4794:25) [angular]
    at eval (http://localhost:3000/assets/@angular/upgrade/bundles/upgrade.umd.js:1615:26) [angular]
    at Object.onInvoke (http://localhost:3000/assets/@angular/core/bundles/core.umd.js:4133:37) [angular]
    at http://localhost:3000/assets/zone.js/dist/zone.js:759:57 [angular]"

```

**What is the motivation / use case for changing the behavior?**
Upgrade a rails app with es6 from angular 1.5.6 to angular 4 without using typescript

**Please tell us about your environment:**
<!-- Operating system, IDE, package manager, HTTP server, ... -->


* **Angular version:** 4.0.3
<!-- Check whether this is still an issue in the most recent Angular version -->

* **Browser:** [all]
<!-- All browsers where this could be reproduced -->
 
* **Language:** [ES6/7]

* **Node (for AoT issues):** `node --version` =   v5.10.0
DynamicNgUpgradeModule fails on Angular 4.0.3 with ES6
issue
created
gkalpak
username_1
@username_0, can you check if this is still an issue on 4.1 and create a runnable demo (e.g. using plnkr)?
comment
created
ignaciodm
username_0
@username_1 Yes, is still an issue on 4.1

This is the plnkr:  https://plnkr.co/edit/0LFmR5JIw6kWM9mlJmXN?p=preview

Thanks!
comment
created
gkalpak
username_1
@username_0, in this example you are using `@angular` modules both imported (via SystemJS) and as regular script tags (which results in different instances of the same imported things). I guess this is messing things up. Try using one way or the other.

(Also you are not downgrading any component, so it is expected that you don't see anything but `loading...`.)

Depending on your usecase and requirements, you should access `@angular` modules in a way that is compatible with both your existing AngularJS app and the new Angular parts. Here is a (bad) POC example that puts everything on windows: [plnkr][1]

##
Closing, since there is no indication that something is wrong in `ngUpgrade` itself.

[1]: https://plnkr.co/edit/YBYFhJeG2B7mxfJDCmpK?p=preview
comment
closed
gkalpak
username_1
issue