Asta4js is a MVVM framework which allows independent html template and separate rendering/binding logic to independent js file from html template.
There is a simple html template which contains a text input and a preview text label.
<div>2w bingind<input name="name"></div>
<div>1w binging:<span id="name-preview"></span></div>Then we can bind the two DOM elements with the javascript model as following:
Aj.init(function($scope){
$scope.data = {};
$scope.snippet("body").bind($scope.data, {
name:[
Aj.form(), //bind the $scope.data.name to input[name=name] in 2-way
"#name-preview" //bind the $scope.data.name to #name-preview in 1-way
]
});
});A complete sample of todoApp shows how we can make things amazing.
More examples can be found at http://astamuse.github.io/asta4js
User guide is at Asta4js wiki
Currently, Asta4js is still in alpha developing, which means it still lacks of some important functionalities, but it can be considered as stable for existing functions because we are using it in our service developing.
Todo things:
- build
- it seems that karma is not a good option for common unit test purpose.
- CI support(better with sauce)
- source format and jshint
- binding
- add test for multiple select
- add support for option group of select
- docs
- complete the basic user guide and reference(has almost covered current situations)
- reimplement the todoApp sample to follow the todoMVC's guide line and submit it to todoMVC.
- make the user list example more beautiful.
- web component support(in progress)
- it has been working with brick.
- waiting for confirm with shadow DOM.
Any issue report or contribution/PR is appreciated.