这是我第一次在StackOverflow上问问题,所以我可能听起来很奇怪。请容忍我。所以,我正在用NativeScript和TypeScript编写一个程序。我想在本地文本-telerik中使用RadListView,但它并不完全起作用。
这就是我的app.component.ts的样子:
import {Component} from "@angular/core";
import {RouteConfig} from "@angular/router-deprecated";
import {HTTP_PROVIDERS} from "@angular/http";
import {NS_ROUTER_DIRECTIVES, NS_ROUTER_PROVIDERS} from "nativescript-angular/router";
import {test} from "./pages/test.component";
@Component({
selector: "main",
directives: [NS_ROUTER_DIRECTIVES],
providers: [NS_ROUTER_PROVIDERS, HTTP_PROVIDERS],
template: "<page-router-outlet></page-router-outlet>"
})
@RouteConfig([
{ path: "/test", component: test, name: "test", useAsDefault: true }
])
export class AppComponent {}这是我的test.component.ts
import {Component, ViewChild, ElementRef, OnInit} from "@angular/core";
import {Page} from "ui/page";
@Component({
selector: "test",
templateUrl: "pages/test.html",
styleUrls: ["pages/test-common.css", "pages/test.css"],
providers: []
})
export class test implements OnInit {
constructor(private page: Page) {}
ngOnInit() {}
}这是我的test.html
<ActionBar title="RadListView"></ActionBar>
<lv:RadListView id="list-view" items="{{ items }}" xmlns='http://schemas.nativescript.org/tns.xsd' xmlns:lv='nativescript-telerik-ui/listview'>
<lv:RadListView.listViewLayout>
<lv:ListViewLinearLayout scrollDirection="Vertical"></lv:ListViewLinearLayout>
</lv:RadListView.listViewLayout>
<lv:RadListView.itemTemplate>
<label text="{{ name }}"></label>
</lv:RadListView.itemTemplate>
</lv:RadListView>我希望能够使用test.component.ts.中的可变项来操作test.html中的RadListView然而,我所做的一切在这一刻都不起作用。有人能在一个例子中教我怎么做吗?
提前谢谢。
发布于 2016-06-21 14:27:32
1) .html文件中的语法不同于xml文件。
2) nativescript-telerik-ui在2.0.0-rc.1之前,所以他们目前正在研究它,您可以检查这个链接https://github.com/telerik/nativescript-ui-samples-angular/issues/1#issuecomment-225791969。
3)如果您使用的是角的β维数,那么请检查这个链接http://docs.telerik.com/devtools/nativescript-ui/Controls/Angular/getting-started
https://stackoverflow.com/questions/37839309
复制相似问题