Reputation: 16964
I receive the following error in IE8 when trying to data-bind a <input>
tag:
Unable to parse bindings.
Message: [object Error];
Bindings value: enable: $root.hasTag('foo')
Essentially, I have an enable data-bind on a checkbox that should disable the checkbox if there are no models with a specific tag.
<input type="checkbox" data-bind="enable: $root.hasTag('foo')" value="foo"
class="filtercheck" />
The viewmodel has the following method to loop through all models and sum up the models with a matching tag, if the value is greater than 0, then return true.
self.hasTag = function(tag) {
var sum = 0;
var item;
for (var i=0; i<this.items().length; i++) {
item = this.items()[i];
if (item.tags().indexOf(tag) != -1) {
sum++;
} else {
continue;
}
}
return (sum > 0) ? true : false;
};
Why does this data-bind throw an error in only IE8?
Upvotes: 0
Views: 1012
Reputation: 15984
I believe it's because indexOf isn't defined in IE8. Did a quick test and it returns undefined. You will have to supply your own version.
Hope this helps.
Upvotes: 2