From 4fc21414581be1825a7ffb5cfda98eda501652d0 Mon Sep 17 00:00:00 2001
From: Igor Minar
Date: Sat, 23 Oct 2010 16:25:53 -0700
Subject: improving the PersonalLog app
- adding jsdocs and comments
- logs should be ordered in inverse order
---
example/personalLog/personalLog.html | 2 +-
example/personalLog/personalLog.js | 22 +++++++++++++++++++---
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/example/personalLog/personalLog.html b/example/personalLog/personalLog.html
index 85a177e9..64a6115d 100644
--- a/example/personalLog/personalLog.html
+++ b/example/personalLog/personalLog.html
@@ -18,7 +18,7 @@
Logs:
- -
+
-
{{log.at | date:'yy-MM-dd HH:mm'}} {{log.msg}}
[x]
diff --git a/example/personalLog/personalLog.js b/example/personalLog/personalLog.js
index dbd0956f..c0273036 100644
--- a/example/personalLog/personalLog.js
+++ b/example/personalLog/personalLog.js
@@ -1,5 +1,20 @@
-//app namespace
-var example = {};
+/**
+ * @fileOverview Very simple personal log demo application to demostrate angular functionality,
+ * especially:
+ * - the MVC model
+ * - testability of controllers
+ * - dependency injection for controllers via $inject and constructor function
+ * - $cookieStore for persistent cookie-backed storage
+ * - simple templating constructs such as ng:repeat and {{}}
+ * - date filter
+ * - and binding onSubmit and onClick events to angular expressions
+ * @author Igor Minar
+ */
+
+
+/** @namespace the 'example' namespace */
+var example = example || {};
+/** @namespace namespace of the personal log app */
example.personalLog = {};
@@ -13,11 +28,12 @@ var LOGS = 'logs';
*/
function LogCtrl($cookieStore) {
var self = this,
- logs = self.logs = $cookieStore.get(LOGS) || [];
+ logs = self.logs = $cookieStore.get(LOGS) || []; //main model
/**
* Adds newMsg to the logs array as a log, persists it and clears newMsg.
+ * @param {string} msg Message to add (message is passed as parameter to make testing easier).
*/
this.addLog = function(msg) {
var newMsg = msg || self.newMsg;
--
cgit v1.2.3