From 3e7b40d33643596dd59b66d25d889126cb2ac9cd Mon Sep 17 00:00:00 2001 From: Junior Conte Date: Thu, 11 May 2017 00:37:24 -0300 Subject: [PATCH] =?UTF-8?q?Organiza=C3=A7=C3=A3o=20da=20estrutura=20do=20c?= =?UTF-8?q?=C3=B3digo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scripts/controllers/main.js | 18 +++++++++--------- app/views/main.html | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/scripts/controllers/main.js b/app/scripts/controllers/main.js index aeb64be..8876238 100644 --- a/app/scripts/controllers/main.js +++ b/app/scripts/controllers/main.js @@ -12,8 +12,8 @@ angular.module('todoApp') var ref = firebase.database().ref().child('todos'); - $scope.hide = $cookies.get('hide') === 'true' || false; $scope.todos = $firebaseArray(ref); + $scope.hide = $cookies.get('hide') === 'true' || false; $scope.addTodo = function(title) { $scope.todos.$add({ @@ -22,12 +22,6 @@ angular.module('todoApp') }); }; - $scope.progress = function() { - return $scope.todos.filter(function(todo) { - return todo.done; - }).length / $scope.todos.length * 100; - }; - $scope.clean = function() { $scope.todos.forEach(function(todo) { if (todo.done) { @@ -36,8 +30,14 @@ angular.module('todoApp') }); }; - $scope.saveHide = function() { - $cookies.put('hide', $scope.hide); + $scope.progress = function() { + return $scope.todos.filter(function(todo) { + return todo.done; + }).length / $scope.todos.length * 100; + }; + + $scope.saveHide = function(hide) { + $cookies.put('hide', hide); }; }); diff --git a/app/views/main.html b/app/views/main.html index 6eccd9c..4bb4f7c 100644 --- a/app/views/main.html +++ b/app/views/main.html @@ -37,7 +37,7 @@

Firetasks