使用2.2获取以下异常。
正在使用以前的版本。
" tns info"并且全部更新为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]
答案 0 :(得分:10)
我使用最新的tns-core-modules和nativescript-angular测试了这个场景,一切都按预期工作。正如@ Panayot.Cankov建议您升级到tns-core-modules@2.2.0
和nativescript-angular@0.3.0
。您可以使用以下命令执行此操作:
tns plugin remove tns-core-modules
tns plugin add tns-core-modules@2.2.0
tns plugin remove nativescript-angular
tns plugin add nativescript-angular@0.3.0
答案 1 :(得分:3)
升级tns-core-modules@2.2.0和nativescript-angular@0.3.0。 经过一些重构之后,我们在tns-core-modules中的View类中引入了cssClasses Set,但是由于不愉快的巧合,nativescript-angular通过在View类上修补自己的cssClasses Array属性来扩展。它已经解决,但是tns-core-modules的新版本将与旧版本的nativescript-angular不兼容。
答案 2 :(得分: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"