check if value exists in object

2 posts, 0 answers
  1. Phil
    Phil avatar
    21 posts
    Member since:
    Nov 2012

    Posted 28 Jan 2013 Link to this post

    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>
    # } #
    # } #

    I'm getting something like this

    Uncaught ReferenceError: paging is not defined

  2. Petyo
    Petyo avatar
    2436 posts

    Posted 30 Jan 2013 Link to this post

    Hi Phil,

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

    Kind regards,
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top