Hi Aik-Siong Koh
Your question is how does Amber compare to Angularjs. My answer is
that I cannot say it yet.
I don't know if you have tried out angularjs yet. It has a ToDo app
on the front page of the web page. The code is pretty compact as you
can see in the copy below.
I have updated Rodrigo Bistolfi's ToDo app for Amber for the latest
Amber 0.12.4.
http://hhzl.github.io/Amber-ToDo-List/
(It uses localStorage to store the ToDo list).
Amber uses more code and not so easy to understand unless you know the
Seaside HTML rendering system.
For a list of list app you have an example in the Smalltalk browsers.
List of packages, list of classes. You can use that as an example to
implement your generic list of list app.
It would be great to have a list of list app both in Amber and
angularjs to compare side by side.
In case you need Amber support please don't hesitate to ask on this list.
Regards
--Hannes
--------------------------------------------------------
Angularjs ToDo app html
--------------------------------------------------------
<!doctype html>
<html ng-app>
<head>
<script src="
https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.7/angular.min.js"></script>
<script src="todo.js"></script>
<link rel="stylesheet" href="todo.css">
</head>
<body>
<h2>Todo</h2>
<div ng-controller="TodoCtrl">
<span>{{remaining()}} of {{todos.length}} remaining</span>
[ <a href="" ng-click="archive()">archive</a> ]
<ul class="unstyled">
<li ng-repeat="todo in todos">
<input type="checkbox" ng-model="todo.done">
<span class="done-{{todo.done}}">{{todo.text}}</span>
</li>
</ul>
<form ng-submit="addTodo()">
<input type="text" ng-model="todoText" size="30"
placeholder="add new todo here">
<input class="btn-primary" type="submit" value="add">
</form>
</div>
</body>
</html>
--------------------------------------------------------
JavaScript
--------------------------------------------------------
function TodoCtrl($scope) {
$scope.todos = [
{text:'learn angular', done:true},
{text:'build an angular app', done:false}];
$scope.addTodo = function() {
$scope.todos.push({text:$scope.todoText, done:false});
$scope.todoText = '';
};
$scope.remaining = function() {
var count = 0;
angular.forEach($scope.todos, function(todo) {
count += todo.done ? 0 : 1;
});
return count;
};
$scope.archive = function() {
var oldTodos = $scope.todos;
$scope.todos = [];
angular.forEach(oldTodos, function(todo) {
if (!todo.done) $scope.todos.push(todo);
});
};
> --
> You received this message because you are subscribed to the Google Groups
> "amber-lang" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
amber-lang+...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.
>