TL;DR Basically I want AngularJS (that's right, AngularJS, not Angular)'s two-way binding without the rest of AngularJS.
My favorite thing about using AngularJS is how easy data binding is. It's so simple, I just include an ng-app
tag and controller in my HTML, initialize my app with a few lines of JavaScript code, and then a {{variableValue}}
in my HTML is automatically filled by the controller's $scope.variableValue.
Is there a library that does only this? (I realize I only described one-way binding, so I'll accept libraries that do one-way binding answers as well).
Just to be clear, I've looked at a few other libraries that do this, and none of them make it as easy on the HTML side. In these other frameworks, such as Remy Sharp's bind or RivetJS, I either have to have a <span id="variableValue"></span>
concept, or I have to explicitly specify that the variableValue
variable binds to an element defined by #variable-value
, etc.
What I'm looking for is:
- A little bit of configuration (this is subjective, I know, but it's a start).
{{variableName}}
in the HTML$scopeVariable.variableName
in JavaScript- and have the two bind together and ... just work.
<div v-bind:class="{ active: isActive }"></div>
. is that a deal breaker, having to addv-bind:
to be able to use{ active: isActive }
?