Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
todomvc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eugene Shen
todomvc
Commits
3db7131f
Commit
3db7131f
authored
Jul 29, 2013
by
Jesus Rodriguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add an if to prevent unneeded saves
parent
401846de
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
architecture-examples/angularjs/js/controllers/todoCtrl.js
architecture-examples/angularjs/js/controllers/todoCtrl.js
+4
-2
No files found.
architecture-examples/angularjs/js/controllers/todoCtrl.js
View file @
3db7131f
...
...
@@ -12,11 +12,13 @@ todomvc.controller('TodoCtrl', function TodoCtrl($scope, $location, todoStorage,
$scope
.
newTodo
=
''
;
$scope
.
editedTodo
=
null
;
$scope
.
$watch
(
'
todos
'
,
function
()
{
$scope
.
$watch
(
'
todos
'
,
function
(
newValue
,
oldValue
)
{
$scope
.
remainingCount
=
filterFilter
(
todos
,
{
completed
:
false
}).
length
;
$scope
.
completedCount
=
todos
.
length
-
$scope
.
remainingCount
;
$scope
.
allChecked
=
!
$scope
.
remainingCount
;
todoStorage
.
put
(
todos
);
if
(
newValue
!==
oldValue
)
{
// This prevents unneeded calls to the local storage
todoStorage
.
put
(
todos
);
}
},
true
);
if
(
$location
.
path
()
===
''
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment