AngularJS awesome JavaScript framework
I was looking for easy and nice solution to maintain my growing JavaScript. I tried Backbone.js which is my opinion a little bit “to” complicated. Of course – you can do everything, but.. it was to much hassle with coding in details. Second approach was to KnockoutJS – this one is really nice but from the other hand – I didn’t have much on control on my code and details, but everything was really nice and sleek. So… Quite similar like with choosing PHP Framework. I wanted something which will do some job for me, but I also wanted to have control on everything. That’s why I chose CodeIgniter which was perfect for me. But… with JavaScript – Finally i funded: AngularJS . Made by Google engineers – but super nice and sleek.
So… really simple working example:
I wanted to create proportion calculator:
<input class="input-mini" type="number" name="x" /> x
<input class="input-mini" type="number" name="y" />
<input class="input-mini" type="number" name="rx" /> x
<input class="input-mini" type="number" name="ry" />
and javascript
function Controller($scope) {
$scope.change = function(what) {
if (what == 1){
$scope.prop.ry = $scope.prop.rx * $scope.prop.y / $scope.prop.x;
} else {
$scope.prop.rx = $scope.prop.ry * $scope.prop.x / $scope.prop.y;
}
};
}
Check on-line demo .