Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
12-31-2013, 03:56 PM #1
- Join Date
- Nov 2012
- Thanked 0 Times in 0 Posts
jQuery-only version of AngularJS's 'Todo app' - improvements?
First post in more than a year, yikes!
I have been scratching the surface of AngularJS recently and their home page contains a simple app as an example of the framework's versatility. The app I'm talking about is the "Todo app".
I decided to reverse engineer this app using only jQuery and here are my results.
I'm pretty happy with the way it turned out. After some QA testing, it seems to operate in all the ways the AngularJS version does (in terms of functionality for the user, it does differ in how those processes are accomplished).
Does anyone have some recommendations for how this jQuery app can be improved? The JS is not optimized yet, so I'm sure it can be truncated, but I was more so curious about potential improvements to the methodology used or perhaps adding some bells and whistles to improve on the basic app itself.
Let me know what you think!
12-31-2013, 08:10 PM #2
- Join Date
- Jun 2007
- Thanked 595 Times in 575 Posts
a few points and observations from 30,000 feet:
it appears that you re-render all items just to change a single item, which could be problematic on an iphone1 with 5000 items...
you could also lighten the load using classes instead of .css() inline styles.
$('.unchecked').length replaces the counting loop in count list.
you can loop through just, for example, $(':checked') in your reset functions, instead of all of the list items.
it's also impossible to call these methods from the page because you don't export the functionality. this makes it hard to call, say, addTodo() using anything except your buttons.