diff options
| author | Caitlin Potter | 2014-02-21 14:31:23 -0500 |
|---|---|---|
| committer | Caitlin Potter | 2014-02-21 14:52:12 -0500 |
| commit | 2f4513339337bb8aa6c9dfe1191d169b4fc57999 (patch) | |
| tree | ce0d47cee3d490c907cef680cc12e131f2a1cbf9 /example/personalLog/personalLog.js | |
| parent | 4a6a3ba7fb08ce99007893ef75365a3e8aff938a (diff) | |
| download | angular.js-2f4513339337bb8aa6c9dfe1191d169b4fc57999.tar.bz2 | |
chore(examples): remove ancient examples from the tree
Let these poor scripts retire, goodness.
Closes #6398
Closes #3310
Diffstat (limited to 'example/personalLog/personalLog.js')
| -rw-r--r-- | example/personalLog/personalLog.js | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/example/personalLog/personalLog.js b/example/personalLog/personalLog.js deleted file mode 100644 index c22b8702..00000000 --- a/example/personalLog/personalLog.js +++ /dev/null @@ -1,72 +0,0 @@ -/** - * @fileOverview Very simple personal log demo application to demonstrate 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 - */ - -//name space isolating closure -(function() { - -var app = angular.module('personalLog', ['ngCookies']); - -var LOGS = 'logs'; - -/** - * The controller for the personal log app. - */ -app.controller('LogCtrl', ['$cookieStore', '$scope', function LogCtrl($cookieStore, $scope) { - - var logs = $scope.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). - */ - $scope.addLog = function(msg) { - var newMsg = msg || $scope.newMsg; - if (!newMsg) return; - var log = { - at: new Date().getTime(), - msg: newMsg - }; - - logs.push(log); - $cookieStore.put(LOGS, logs); - $scope.newMsg = ''; - }; - - - /** - * Persistently removes a log from logs. - * @param {object} log The log to remove. - */ - $scope.rmLog = function(log) { - for ( var i = 0; i < logs.length; i++) { - if (log === logs[i]) { - logs.splice(i, 1); - break; - } - } - - $cookieStore.put(LOGS, logs); - }; - - - /** - * Persistently removes all logs. - */ - $scope.rmLogs = function() { - logs.splice(0, logs.length); - $cookieStore.remove(LOGS); - }; -}]); - -})(); |
