Permalink
Browse files

Add manual and compiled version

  • Loading branch information...
1 parent d904bee commit 53a2bfdc8447ed46aa1526aab922a108c009f36a @abtris committed May 19, 2012
Showing with 127 additions and 60 deletions.
  1. +61 −59 app/todo.js
  2. +65 −0 app/todo.manual.js
  3. +1 −1 build.xml
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -0,0 +1,65 @@
+var module = angular.module('todoApp', []);
+/**
+ * Todo controller
+ * @class
+ * @name TodoCtrl
+ * @param {Object} $scope
+ * @param {Object} $http
+ */
+module.controller('TodoCtrl', function ($scope, $http) {
+ $scope.todos = [
+ {text:'learn angular', done:true},
+ {text:'build an angular app', done:false}];
+
+ $scope.url = "proxy.php";
+ /**
+ * Add todo
+ * @name addTodo
+ * @memberOf TodoCtrl
+ * @function
+ */
+ $scope.addTodo = function() {
+ $http.defaults.headers.post['Content-Type']='application/json';
+ $http.defaults.headers.post['Access-Control-Allow-Origin'] = 'http://angular.dev https://api.mongohq.com';
+
+ id = new Date().getTime();
+ $scope.data = '{"document" : {"_id": "' + id + '" , "text" : "' + $scope.todoText + '"}, "done" : false }';
+ todo = {text:$scope.todoText, done:false};
+ $scope.todos.push(todo);
+ // $http.jsonp($scope.url).successCallback()
+ $http.post($scope.url, $scope.data).success($scope.successCallback);
+ };
+ /**
+ * Sucess Callback
+ * @name successCallback
+ * @memberOf TodoCtrl
+ * @function
+ */
+ $scope.successCallback = function () {
+ };
+ /**
+ * Remaining
+ * @name remaining
+ * @memberOf TodoCtrl
+ */
+ $scope.remaining = function() {
+ var count = 0;
+ angular.forEach($scope.todos, function(todo) {
+ count += todo.done ? 0 : 1;
+ });
+ return count;
+ };
+ /**
+ * Archive
+ * @name archive
+ * @memberOf TodoCtrl
+ */
+ $scope.archive = function() {
+ var oldTodos = $scope.todos;
+ $scope.todos = [];
+ angular.forEach(oldTodos, function(todo) {
+ if (!todo.done) $scope.todos.push(todo);
+ });
+ };
+});
+
View
@@ -36,7 +36,7 @@
<target name="docs">
<exec executable="jsdoc" failonerror="true">
- <arg line="app/todo.js" />
+ <arg line="app/todo.manual.js" />
<arg line="-t=/usr/local/Cellar/jsdoc-toolkit/2.3.2/libexec/jsdoc-toolkit/templates/jsdoc" />
<arg line="-d=reports/docs" />
</exec>

0 comments on commit 53a2bfd

Please sign in to comment.