1

I have an apache cordova typescript project with ng2.0.0-beta.0 package configured and successfully working on startup, see package.json and javascript console output below.

I was attempting to move to the current ng2.0.0-beta.7 package in that project to see if it address an unexpected issue I am experiencing where views are not updating when template referenced class member variables changed, for details see "cordova app angular 2 member variable update not updating template reference to it".

When I switch to ng2.0.0-beta.7 package everything transpiles fine but ng2 doesn't successfully startup, see package.json and javascript console output below.

I have repro for the ng2.0.0-beta.0 case in master branch of https://github.com/myusrn/acu6withng2 and ng2.0.0-beta.7 case in acu6withng27 topic branch https://github.com/myusrn/acu6withng2/tree/acu6withng27.

Anyone seen this runtime error with ng2.0.0-beta.7 and if so is it due to some step i'm overlooking or perhaps there is a known fix for it?

ng2.0.0-beta.7 package.json

"dependencies": {
    "angular2": "2.0.0-beta.7",
    "es6-promise": "3.0.2",
    "es6-shim": "0.33.3",
    "reflect-metadata": "0.1.2",
    "rxjs": "5.0.0-beta.2",
    "systemjs": "0.19.9",
    "zone.js": "0.5.10"
  },

ng2.0.0-beta.7 runtime javascript console output errors

Uncaught TypeError: Cannot redefine property: onreadystatechange
angular2-polyfills.js (1569,25)
DEPRECATION WARNING: 'enqueueTask' is no longer supported and will be removed in next major release. Use addTask/addRepeatingTask/addMicroTask
angular2-polyfills.js (1152,18)
DEPRECATION WARNING: 'dequeueTask' is no longer supported and will be removed in next major release. Use removeTask/removeRepeatingTask/removeMicroTask
angular2-polyfills.js (1152,18)
reflect-metadata shim is required when using class decorators
    Error loading http://localhost:4400/app/main.js
angular2-polyfills.js (468,17)

ng2.0.0-beta.0 package.json

"dependencies": {
    "angular2": "2.0.0-beta.0",
    "es6-promise": "3.0.2",
    "es6-shim": "0.33.3",
    "reflect-metadata": "0.1.2",
    "rxjs": "5.0.0-beta.0",
    "systemjs": "0.19.9",
    "zone.js": "0.5.10"
  },

ng2.0.0-beta.0 runtime javascript console output

Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode.
angular2.dev.js (351,13)

ng2.0.0-beta.0/.7 index.html

<!-- Cordova reference, this is added to your app when it's built. -->
<script src="cordova.js"></script>
<script src="scripts/platformOverrides.js"></script>
<!--<script src="scripts/appbundle.js"></script>-->
<script src="scripts/index.js"></script>

<!-- 1. Load libraries needed for ng2 -->
<script src="node_modules/es6-shim/es6-shim.js"></script>
<script src="node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="node_modules/rxjs/bundles/Rx.js"></script>
<script src="node_modules/angular2/bundles/angular2.dev.js"></script>
<script src="node_modules/angular2/bundles/router.dev.js"></script>
<script src="node_modules/angular2/bundles/http.dev.js"></script>
Community
  • 1
  • 1
myusrn
  • 1,050
  • 2
  • 15
  • 29
  • i am not using beta 7.0 yet but seems there is nothing changed according to changelog in the beta 7.0 see https://github.com/angular/angular/blob/master/CHANGELOG.md#200-beta7-2016-02-18 – Pardeep Jain Mar 05 '16 at 17:02
  • Could you provide the content of your main HTML file? (scripts, SystemJS configuration, ...) Thanks! – Thierry Templier Mar 05 '16 at 17:58
  • Hi @Pardeep, thanks for response. I'd agree that not much has changed from ng2.0.0-beta.6 to .7 but seems like lots of changes going from ng2.0.0.0-beta.0 to .7 if i'm reading that change log page details correctly. – myusrn Mar 05 '16 at 21:43
  • Hi @Thierry, thanks for response. I've added index.html tags details above which is the same for both cases. More specifics on the contents of index.html, index.ts, app/main.ts and app/app.component.ts can also be found in the github repo I provided reference to. – myusrn Mar 05 '16 at 21:45

1 Answers1

2

I found a resolution to this which involved simply adding the following to index.html script tags list and worked with new ng 2.0.0-beta.8 package as well.

<script src="node_modules/reflect-metadata/Reflect.js"></script>

Since this detail isn't a part of the current https://angular.io/guide/quickstart I'm not sure if the difference is a problem with my hello world project environment or a detail that needs to get added to quickstart notes on what should go in index.html script tags.

rjdkolb
  • 10,377
  • 11
  • 69
  • 89
myusrn
  • 1,050
  • 2
  • 15
  • 29