1

I'm using the built-in ListView and have the following setup.

<ListView items="{{ myItems }}" itemLoading="onItemLoading" itemTemplateSelector="onTemplateSelector">
<ListView.itemTemplates>
  <template key="even">
    <Label text="{{ age }}" style.backgroundColor="white" />
  </template>
  <template key="odd">
    <Label text="{{ age }}" style.backgroundColor="gray" />
  </template>
</ListView.itemTemplates>

During the onLoadingEvent - where each item is about to be loaded, I look at the args.view and it's always undefined. I would have expected it to be the full template view structure - depending on what onTemplateSelector returned.

Looking at some more of the documentation and it seems that if it's undefined then you've got to create the entire structure within code.

Did I miss something? If no, then what's the purpose of allowing the template item definitions (e.g. Label in my sample code).

1
  • A work-around could be - can I pass an xml definition in a string to a function and have it create the views in the xml. This in {N} w/o Angular. Commented Mar 22, 2017 at 23:30

1 Answer 1

1

If you just do

<ListView.itemTemplates> <Label text="{{ age }}" style.backgroundColor="gray" /> </ListView.itemTemplates>

That will work fine. I'm not sure what your <template> element is.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.