data-bind="html: xx" returns undefined

2 posts, 0 answers
  1. Kee
    Kee avatar
    8 posts
    Member since:
    Sep 2012

    Posted 25 Jul 2013 Link to this post

    Hi,

    I am trying to solve an issue where the data-bind="html:xx", returns "undefined" when the data "xx" is null or not defined.  It does not happen if this changes to text binding.  Is there any way to work around this on the client side?

    Thanks for your help.
    Kee Yang
  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 29 Jul 2013 Link to this post

    Hello Kee,

    Basically you can use function that handles the undefined case and bind the html to that function instead.

    e.g.

    http://jsbin.com/emujoz/2/edit

    foo: function(){
       return this.get('someFieldThatIsNull')||"";
    }


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