View Full Version : Check for undefined array using the tpl 'if' operator

5 Jan 2011, 10:31 AM

I have a Panel, to which I'm adding three Lists, each with a header Component.

The templates for each of the lists are defined in the index.html.

In some instances, the array returned from the server, for one or all of the lists, may be undefined.
In this case, I'd like to use a conditional statement in my templates to display something like "Add New" (this would then have an itemTap event that would allow the user to add data to that collection and save it to the server)
Otherwise, I iterate over the collection and display the appropriate data.

Can the 'if' operator be used to test for "undefined" or would I have to apply the logic further upstream?

Thanks for your help,