Nativescript 2.2异常

Nativescript 2.2异常,nativescript,Nativescript,使用2.2获取以下异常 正在使用以前的版本 Did“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: _

使用2.2获取以下异常

正在使用以前的版本

Did“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]

升级两个tns核心-modules@2.2.0和nativescript-angular@0.3.0.
经过一些重构后,我们在tns核心模块的视图类上引入了cssClasses集,但不幸的是,nativescript angular通过在视图类上修补其自己的cssClasses数组属性进行了扩展。问题已经解决,但新版本的tns核心模块将与旧版本的nativescript angular不兼容。

我使用最新的tns核心模块和nativescript angular测试了此场景,一切正常。@Panayot.Cankov建议您应该升级到
tns-core-modules@2.2.0
nativescript-angular@0.3.0
。可以使用以下命令执行此操作:

  • tns插件删除tns核心模块
  • tns插件添加tns核心-modules@2.2.0
  • tns插件删除nativescript
  • tns插件添加nativescript-angular@0.3.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"