Having read the watch and read the front page of angular.js it seems to be just as powerful as ember.js. Its got bi-directional binding, a template engine, name spaces. The terminology they have is FP (ala Scala). They have apply, future promise. So gave a try.
function LenderController($scope, $http) {
$scope.lenders = [];
$scope.all = function() {
$http.get('/lenders').success(function(data) {
$scope.lenders = data;
});
};
}
<div class="span10" ng-controller="LenderController">
<table class="table striped">
<tr>
<th>Name</th><th>Category</th><th>Url</th>
</tr>
<tr ng-repeat="lender in lenders">
<td>{{lender.name}}</td> <td>{{lender.category}}</td> <td>{{lender.url}}</td>
</tr>
</table>
<a href="" ng-click="all()">fetch all</a>
</div>
Pretty short and direct code for fetching from json/rest backend and displaying it on the view. I think Angular.js is powerful and yet easy for a newbie to pickup. That is my first few mins impression of it.
No comments:
Post a Comment