knockout 3.3.0 question

89 views
Skip to first unread message

ggarcia271...@gmail.com

unread,
Aug 24, 2015, 4:57:46 PM8/24/15
to KnockoutJS
Is anyone using knockout v 3.3.0 having problems with text bindings? I think that the v8 javascript web debugger's thread can return observable arrays / observables out of order when returning data from the server however I'm getting an uncaught reference error that shows: unable to process binding "text: function() { return <myObservableArrayItemName> }" Message: MyObservableArrayItemName is not defined. I'm getting a similar error when reverting to version 2 of the script.

Ian Yates

unread,
Aug 25, 2015, 5:50:15 AM8/25/15
to KnockoutJS
No issues that I've seen.

How about you comment out the binding, and then use your F12 tools to call ko.dataFor(<htmlElementHere>) so you can see what view model object is active at that point in your binding.
If it ends up being the right one, then your HTML structure is binding that bit a little early.  You can solve this in a couple of ways
a) Use an if: binding to avoid rendering that HTML until your data is ready
b) Use $data.myObservableArrayItemName in your binding expression.  That will just return undefined rather than crash.


On Tuesday, August 25, 2015 at 6:57:46 AM UTC+10, ggarcia271...@gmail.com wrote:

ggarcia271...@gmail.com

unread,
Aug 25, 2015, 2:57:24 PM8/25/15
to KnockoutJS
ko.dataFor(<htmlElementHere>) isn't working at the moment with the HTML element's selector nor is using ko.dataFor(self.results) self.results is an unbound ko.observableArray. It was working about a week ago... however when using a click binding with another binding, within days after coding that and having no problems then debugging, the error happened.

a.) how is it possible to avoid rendering markup?
b.) i'd really prefer not to introduce an additional layer of complexity into the project as i'm using jQuery in several other places and mainly for doing UI type-stuff and $ajax calls due to interacting with a .NET and SQL Server database.
Reply all
Reply to author
Forward
0 new messages