2016-08-11 29 views
1

以2.2獲得以下例外。Nativescript 2.2例外

正在與以前的版本。

真的 「TNS信息」,所有更新到2.2

JS: Error: Uncaught (in promise): EXCEPTION: Error in pages/listview/listview.html:12:2 
JS: ORIGINAL EXCEPTION: TypeError: _this.cssClasses(...).set is not a function 
JS: ORIGINAL STACKTRACE: 
JS: TypeError: _this.cssClasses(...).set is not a function 
JS:  at /data/data/org.nativescript.test1/files/app/tns_modules/nativescript-angular/view-util.js:254:78 
JS:  at Array.forEach (native) 
JS:  at ViewUtil.setClasses (/data/data/org.nativescript.test1/files/app/tns_modules/nativescript-angular/view-util.js:254:17) 
JS:  at ViewUtil.setPropertyInternal (/data/data/org.nativescript.test1/files/app/tns_modules/nativescript-angular/view-util.js:189:18) 
JS:  at ViewUtil.setProperty (/data/data/org.nativescript.test1/files/app/tns_modules/nativescript-angular/view-util.js:181:18) 
JS:  at NativeScriptRenderer.setElementProperty (/data/data/org.nativescript.test1/files/app/tns_modules/nativescript-angular/renderer.js:141:23) 
JS:  at NativeScriptRenderer.setElementAttribute (/data/data/org.nativescript.test1/files/app/tns_modules/nativescript-angular/renderer.js:145:21) 
JS:  at DebugAppView._View_ListviewPage0.createInternal (ListviewPage.template.js:58:17) 
JS:  at DebugAppView.AppView.create (/data/data/org.nativescript.test1/files/app/tns_modules/@angular/core/src/linker/view.js:87:21) 
JS:  at DebugAppView.create (/data/data/org.nativescript.test1/files/app/tns_modules/@angular/core/src/linker/view.js:299:44) 
JS: ERROR CONTEXT: 
JS: [object Object] 

回答

10

我用最新的tns-core-modules和nativescript-angular測試了這個場景,一切都按預期工作。由於@ Panayot.Cankov建議您升級到[email protected][email protected]。你可以這樣做,使用下面的命令:

  1. tns plugin remove tns-core-modules
  2. tns plugin add [email protected]
  3. tns plugin remove nativescript-angular
  4. tns plugin add [email protected]
+0

好的工作 - 謝謝。 – dashman

3

同時升級[email protected][email protected]。 經過一些重構之後,我們在tns-core-modules的View類中引入了cssClasses Set,但是由於不愉快的巧合,nativescript-angular通過在View類上修改了自己的cssClasses Array屬性來擴展。它已經解決,但tns-core-modules的新版本將不兼容舊版本的nativescript-angular。

0

確保你升級你的角度依賴性太大,我收到了同樣的錯誤,直到我碰到rc4。下面的依賴關係現在適用於我。

"@angular/common": "2.0.0-rc.4", 
    "@angular/compiler": "2.0.0-rc.4", 
    "@angular/core": "2.0.0-rc.4", 
    "@angular/http": "2.0.0-rc.4", 
    "@angular/platform-browser": "2.0.0-rc.4", 
    "@angular/platform-browser-dynamic": "2.0.0-rc.4", 
    "@angular/platform-server": "2.0.0-rc.4", 
    "@angular/router-deprecated": "2.0.0-rc.2", 
    "nativescript-angular": "^0.3.0", 
    "nativescript-drop-down": "^1.3.2", 
    "rxjs": "5.0.0-beta.6", 
    "tns-core-modules": "^2.2.1", 
    "zone.js": "^0.6.12"