Commit a960f9a4 authored by dmitriz's avatar dmitriz

angularjs-perf: Remove global var todomvc

parent fb0c821f
......@@ -3,8 +3,8 @@
'use strict';
/**
* The main TodoMVC app module
* The main TodoMVC app module that pulls all dependency modules declared in same named files
*
* @type {angular.Module}
*/
var todomvc = angular.module('todomvc', []);
angular.module('todomvc', ['todoCtrl', 'todoEscape', 'todoStorage']);
/*global todomvc, angular */
/*global angular */
'use strict';
angular.module('todoCtrl', [])
/**
* The main controller for the app. The controller:
* - retrieves and persists the model via the todoStorage service
* - exposes the model to the template and provides event handlers
*/
todomvc.controller('TodoCtrl', function TodoCtrl($scope, $location, $filter, todoStorage) {
.controller('TodoCtrl', function TodoCtrl($scope, $location, $filter, todoStorage) {
var todos = $scope.todos = todoStorage.get();
$scope.newTodo = '';
......
/*global todomvc */
/*global angular */
'use strict';
angular.module('todoEscape', [])
/**
* Directive that executes an expression when the element it is applied to gets
* an `escape` keydown event.
*/
todomvc.directive('todoEscape', function () {
.directive('todoEscape', function () {
var ESCAPE_KEY = 27;
return function (scope, elem, attrs) {
elem.bind('keydown', function (event) {
......
/*global todomvc */
/*global angular */
'use strict';
angular.module('todoFocus', [])
/**
* Directive that places focus on the element it is applied to when the expression it binds to evaluates to true
*/
todomvc.directive('todoFocus', function ($timeout) {
.directive('todoFocus', function ($timeout) {
return function (scope, elem, attrs) {
scope.$watch(attrs.todoFocus, function (newVal) {
if (newVal) {
......
/*global todomvc */
/*global angular */
'use strict';
angular.module('todoStorage', [])
/**
* Services that persists and retrieves TODOs from localStorage
*/
todomvc.factory('todoStorage', function () {
.factory('todoStorage', function () {
var STORAGE_ID = 'todos-angularjs-perf';
return {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment