This is a migrated thread and some comments may be shown as answers.

check if value exists in object

1 Answer 762 Views
Templates
This is a migrated thread and some comments may be shown as answers.
Phil
Top achievements
Rank 1
Phil asked on 29 Jan 2013, 02:04 AM
running a template on a data object of pictures returned from facebook

Object {data: Array[8]}
data: Array[8]
__proto__: Object

sometimes the object returns an additional array of 'paging', sometimes it doesn't

How can I get something like this?

<script id="albums-photos-template" type="text/x-kendo-template">
# if (paging) { #
# if (paging.previous) { #
<a href='#= paging.previous #' class='albums-prev'>prev</a>
# } #
# } #
etc

I'm getting something like this

Uncaught ReferenceError: paging is not defined


1 Answer, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 30 Jan 2013, 08:35 AM
Hi Phil,

You may use the typeof operator - if paging is not present, it will return undefined.

Kind regards,
Petyo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Templates
Asked by
Phil
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Share this question
or