问题
Can't bind for attribute in IE8
http://jsfiddle.net/k2Mq7/ - ko 2.1:
SCRIPT5022: Unable to parse bindings.
Message: SyntaxError: Expected identifier, string or number;
Bindings value: attr: { id: 'that-works', for: 'but-than-not' }
http://jsfiddle.net/k2Mq7/3/ - ko 2.1 quoted for ('for'):
jsfiddle fails but on my local machine no any errors but this label displayed without for attribute.
Is it Knockoutjs bug or that I am doing something wrong?
回答1:
Use quotation marks for attributes names like this:
<label data-bind="attr: { 'for': vmProperty }"></label>
来源:https://stackoverflow.com/questions/21937632/knockout-js-for-attribute-binding-in-ie8