Reputation: 1110
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>
Upvotes: 1
Views: 443
Reputation: 1110
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.
Upvotes: 2