NativeScript RadListView rootLocator不是一个函数

时间:2017-08-28 08:52:29

标签: angular telerik nativescript

我使用RadListView如下,但我得到了非常奇怪的错误:

        <RadListView [items]="dataItems">
            <ng-template tkListItemTemplate let-item="item">
                <StackLayout orientation="vertical">
                    <Label class="nameLabel" [text]="item.title"></Label>
                </StackLayout>
            </ng-template>
        </RadListView>

就像它在这里https://github.com/telerik/nativescript-ui-samples-angular/tree/release/sdkAngular/app/listview/getting-started一样。
但问题是我得到以下异常: enter image description here

2 个答案:

答案 0 :(得分:2)

尝试升级package.json文件中的所有依赖项,同时按照下面附带的示例尝试重建您的应用。

{
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "nativescript": {
    "id": "org.nativescript.test"
  },
  "dependencies": {
    "@angular/animations": "~4.2.0",
    "@angular/common": "~4.2.0",
    "@angular/compiler": "~4.2.0",
    "@angular/core": "~4.2.0",
    "@angular/forms": "~4.2.0",
    "@angular/http": "~4.2.0",
    "@angular/platform-browser": "~4.2.0",
    "@angular/router": "~4.2.0",
    "nativescript-angular": "~4.2.0",
    "nativescript-telerik-ui-pro": "^3.0.4",
    "nativescript-theme-core": "~1.0.2",
    "reflect-metadata": "~0.1.8",
    "rxjs": "~5.4.2",
    "tns-core-modules": "~3.1.0",
    "zone.js": "~0.8.2"
  },
  "devDependencies": {
    "nativescript-dev-typescript": "~0.5.0",
    "typescript": "~2.4.2"
  }
}

请记住在重建之前再次删除node_modules,平台和挂钩文件夹。

答案 1 :(得分:2)

问题在于依赖关系。我按照this所述的here文件更新了依赖关系和版本号。它的工作正常。