NativeScript RadListView component template

231 Views Asked by At

I am trying to use an Angular component as the template for RadListView.

<StackLayout>
  <RadListView [items]="stories"
               marginRight="-2"
               separatorColor="transparent"
               height="100%">
    <ng-template tkListItemTemplate
                 let-story="item">
      <NewsItem [story]="story"></NewsItem>
    </ng-template>
  </RadListView>
</StackLayout>

I get the following error.

file:///app/tns_modules/tns-core-modules/ui/core/view/view.js:57:124: JS ERROR Error: onMeasure() did not set the measured dimension by calling setMeasuredDimension() ProxyViewContainer(435)

1

There are 1 best solutions below

0
On BEST ANSWER

Figured it out. The template itself must have a container.

<StackLayout>
  <RadListView [items]="stories"
               marginRight="-2"
               separatorColor="transparent"
               height="100%">
    <ng-template tkListItemTemplate
                 let-story="item">
      <StackLayout>
        <NewsItem [story]="story"></NewsItem>
      </StackLayout>
    </ng-template>
  </RadListView>
</StackLayout>