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

data-bind="html: xx" returns undefined

1 Answer 67 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Kee
Top achievements
Rank 1
Kee asked on 25 Jul 2013, 03:40 PM
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

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 29 Jul 2013, 06:36 AM
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!
Tags
General Discussions
Asked by
Kee
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or