-
Notifications
You must be signed in to change notification settings - Fork 28
Startup
e-ryu edited this page Jul 1, 2015
·
1 revision
Asta4js requires JQuery 2.x as necessary, thus you must include the following source in all your html template files which are using Asta4js.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="/aj.js"></script>
Asta4js separates the rendering/binding logic from the html file, so you can keep your html files clean without any intrusive declaration. Basically, you would have two files:
-
html
A html file decides the visual form of how the data should be shown
<div>2w bingind<input name="name"></div> <div>1w binging:<span id="name-preview"></span></div>
-
js
A javascript file contains the logic about which data should be rendered/bound to where(the html DOM element), and also implements all the logic about retrieving data and user action event binding.
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 ] }); });