- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
Nativescript radListView 不显示 ios 和 android 操作系统上组件的绑定(bind)项。
操作栏和通常的 ListView 显示数据,但 radlistview 不显示。控制台没有显示错误。但我看到下一个存储库中的 RadListView 可以工作 -> https://github.com/telerik/nativescript-ui-samples-angular
我的开发环境如下。
操作系统:macOS Sierra 10.12.6
节点:v6.12.0
npm:2010 年 10 月 3 日
nativescript 和其他内容可以在 package.json 中看到
我似乎这个问题与这些有关......
但我无法精炼。
我在“tns create ui-test --ng”之后在 Angular 上实现了 RadListView,如下所示。
组件
export class ItemsComponent implements OnInit {
private _dataItems: ObservableArray<Item>;
constructor() {
}
get dataItems(): ObservableArray<Item> {
return this._dataItems;
}
ngOnInit() {
this._dataItems = new ObservableArray([
{ id: 1, name: "Ter Stegen", role: "Goalkeeper" },
{ id: 3, name: "Piqué", role: "Defender" },
{ id: 4, name: "I. Rakitic", role: "Midfielder" }
]);
}
}
html
<ActionBar title="My App" class="action-bar">
</ActionBar>
<GridLayout>
<RadListView [items]="dataItems">
<ng-template let-item="item">
<StackLayout>
<Label class="nameLabel" text="text"></Label>
<Label class="nameLabel" [text]="item.name"></Label>
<Label class="descriptionLabel" [text]="item.role"></Label>
</StackLayout>
</ng-template>
</RadListView>
</GridLayout>
package.json
{
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"readme": "NativeScript Application",
"repository": "<fill-your-repository-here>",
"nativescript": {
"id": "org.nativescript.uitest",
"tns-ios": {
"version": "3.3.0"
}
},
"dependencies": {
"@angular/common": "~5.0.0",
"@angular/compiler": "~5.0.0",
"@angular/core": "~5.0.0",
"@angular/forms": "~5.0.0",
"@angular/http": "~5.0.0",
"@angular/platform-browser": "~5.0.0",
"@angular/platform-browser-dynamic": "~5.0.0",
"@angular/router": "~5.0.0",
"nativescript-angular": "5.0.0",
"nativescript-fresco": "^3.0.2",
"nativescript-intl": "^3.0.0",
"nativescript-pro-ui": "3.3.0",
"nativescript-unit-test-runner": "^0.3.2",
"rxjs": "^5.5.2",
"tns-core-modules": "3.4.0",
"zone.js": "~0.8.2"
},
"devDependencies": {
"nativescript-dev-typescript": "~0.5.0",
"typescript": "~2.4.2"
}
}
最佳答案
我确实得到了你的代码并放入了 home.componenttns 创建 uitest --ng 之后然后 tns 插件添加 nativescript-ui-listviewtns平台删除androidtns平台添加androidtns 构建 Androidtns运行android
如果您没有忘记在 home.module.ts 中导入此模块,它就会起作用:NativeScriptUIListViewModule
import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
import { NativeScriptCommonModule } from "nativescript-angular/common";
import { NativeScriptUIListViewModule } from "nativescript-ui-listview/angular";
import { HomeRoutingModule } from "./home-routing.module";
import { HomeComponent } from "./home.component";
@NgModule({
imports: [
NativeScriptCommonModule,
HomeRoutingModule,
NativeScriptUIListViewModule
],
declarations: [
HomeComponent
],
schemas: [
NO_ERRORS_SCHEMA
]
})
export class HomeModule { }
使用此 item.model.ts
export class Item {
id: number;
name:string;
role: string;
}
重要
在另一个项目中,直到我在 app.module.ts 中添加这些行后它才起作用
import { NativeScriptUIListViewModule } from "nativescript-ui-listview/angular/listview-directives";
@NgModule({
imports: [
...
NativeScriptUIListViewModule
关于angular - Nativescript radListView不显示项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48078041/
代码:
我有一个 RadListView 和一个绑定(bind)到 lstGameWaypoints_ItemCommand 的事件处理程序,如下所示。在第一次显示网格时,单击删除按钮成功触发回发和 Item
我对 NativeScript 和 Javascript 开发总体来说是新手。我的背景是Android。 背景: 作为一项测试,我尝试使用 NativeScript 复制我的一个旧应用程序,但遇到了问
我需要在同一页面上有多个 RadListView,我正在使用 NativeScript Angular 我不知道每个列表中的项目数,并且项目的大小可能会非常不同,具体取决于项目包含的文本量。 可以这么
我正在使用 RadListView 控制来自 Telerik UI for WindowsForms . 我一步一步做的是这样的: 为控件设置数据源。 手动向下滚动垂直滚动条 计时器计时结束后,数据源
我正在开发我的移动应用程序,并尝试使用 nativescript 对其进行编码,但我有一个问题,我想在 listView 中为项目 View 设置动画 ... 到目前为止,这是我的代码: let pa
我只是尝试设置客户端 RadListView 项目模板内的 telerik RadButton 的复选框(使用 javascript/jquery)。 RadListView:
TNS v2.5.0 我已将 LISTVIEW_DIRECTIVES 导入到我的 app.module 中,我的模板如下所示
我是一名优秀的程序员,十分优秀!