嗨我正在使用带角度2的{N} 从RadListView
访问Id中的视图时出现以下错误<RadListView id="listView" [items]="posts" loadOnDemandMode="Manual" scrollDirection="Vertical"
itemInsertAnimation="Fade" itemDeleteAnimation="Fade"
(loadMoreDataRequested)="onLoadMoreItemsRequested($event)">
<template tkListItemTemplate let-post="item">
<CardView id="post-{{ post.kl_id }}" margin="8 0 8 0" elevation="15" class="whiteCard" shadowOffsetHeight="3" shadowOffsetWidth="1">
<Label (tap)="doSomethingWithPost(post)"></Label>
</CardView>
</template>
</RadListView>
在我的组件中
let view = require("ui/core/view");
doSomethingWithPost(post){
let postGridLayout = view.getViewById(this.page, "post-" + post.kl_id);
}
我收到以下错误
TypeError: undefined is not an object (evaluating 'value.view.itemView')
答案 0 :(得分:0)
使用viewChild
@ViewChild(/* id like*/ 'foo') myElement: ElementRef;
ngAfterViewInit() {
let myfoo= this.myElement
}