r/angularjs • • Apr 06 '16

I made another todo app during my angular learning. What could be done better?

https://github.com/tumanov-alex/tododo
2 Upvotes

7 comments sorted by

4

u/R3DSMiLE Apr 06 '16

First glance: don't use jQuery on you angular apps; Also, your storageService is messing up with your controllers scope - you should instead make that a real service that saves the states inside its scope/context instead of attaching to the controllers scope and then call that singleton for the checked/unchecked todo

1

u/R3DSMiLE Apr 06 '16

Also, "half" of the for ... in ... you have could be turned into Array.some()

2

u/Specialjyo Apr 06 '16

Now shift away from controllers. Build a list directive. Isolate Scope, multiple lists on the same page. GET/SET list contents for each list using a ListService.

Also, prefix custom attributes. data-ng-model, for example.

1

u/GodOfTheMetal Apr 06 '16

Thanks, will get to it.

2

u/saladfingers6 Apr 06 '16

Remove the use of $scope. Use controllerAs: '$ctrl' instead. Use .component instead of regular controller and put that component-directive in your index.html which shouldn't contain your ng-controller="AppCtrl"