I know that one can always define own custom attributes for an HTML tag.
I also know that data-bind is the keyword knockout.js chose as the HTML attribute that links the data to the UI.
So far so good.
What I am curious to know is whether when I come across HTML on some website and I see that it uses the attribute data-bind, does it always imply it uses knockout.js?
<span class="chk" data-bind="visible: selectedAnswers().length > 0" />
In other words, what is the likelihood that a website using the data-bind attribute is not using knockout.js?
No it's not... I've used data-bind in projects not involving knockout. As long as it makes sense as to what the data is going to be used for then you can use whatever string you want (within reason, see below)...
data-bind=""
data-binder=""
data-im-a-data-attribute=""
The data-* attributes consist of two parts:
1) The attribute name should not contain any uppercase letters, and must be at least one character long after the prefix "data-"
2)The attribute value can be any string
Info obtained from here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With