17 votes
Accepted

AngularJS - REST + Authentication service

Avoiding the fact this code appears to be off-topic (because you mention it's incomplete), I still think it would prompt an interesting review. I'm so pretty Let's first address some superficial ...
user avatar
  • 3,753
14 votes

Cardshifter game lobby

Well, there's lots of code needing review. I've done my best to split it into each language. I've avoided reviewing Angular, since it's a library I'm not comfortable with. HTML: You have tons and ...
user avatar
14 votes

Cardshifter game lobby

Tables for layout This is a clear and obvious misuse of the table element. Tables are for representing tabular data and that's it. Would that same content make sense in a spreadsheet? If the ...
user avatar
  • 3,624
13 votes
Accepted

Simple Async Google Maps initializer with AngularJS

I like it, you could clean up the commented out code and possibly replace $window.googleMapsInitialized = function () { mapsDefer.resolve(); }; ...
user avatar
  • 32.5k
13 votes

Cardshifter game lobby

There's not much to cover, other than the things @IsmaelMiguel went over, nonetheless: The Mundane: This is less of a important thing, as a style thing, but: ...
user avatar
  • 11.8k
13 votes
Accepted

Cardshifter game lobby

Background: I work as a web developer at a company. I'm the only Angular guy here, and we are using Angular in our greenfield CRM project, so my answer will mainly address Angular (as no one else has ...
user avatar
  • 3,753
11 votes
Accepted

Hexadecimal to RGB conversion

A few notes: I am confused as to why you need AngularJS for this. I prefer to use the bitwise & with 255 instead of ...
user avatar
  • 21.7k
10 votes
Accepted

Draggable Resizeable Box

From a once over: It makes more sense from a UX experience to create the box on click then on mousedown There are a number of ...
user avatar
  • 32.5k
9 votes

Cardshifter game lobby

You should use strict mode in your JS scripts. It will allow you to avoid a lot of common mistakes. See the section "Changes in strict mode" in the MDN article I linked. Some of the advantages of ...
8 votes
Accepted

AngularJS Todo List - too much controller logic?

This is a funny question because One of the most readable Angular submissions on CR There is probably too much logic in the controller indeed Some observations: It seems the controller knows too ...
user avatar
  • 32.5k
8 votes
Accepted

Angular todo list

$scope.user = gon.current_user What's gon? I assume it's your authentication/session object with all the things the app needs ...
user avatar
  • 24.8k
7 votes
Accepted

A directive allowing to make a whole DOM subtree readonly

Generally speaking, you should avoid looking outside the current directive for anything that would affect your internal state (bar events). The preferred method of communication is scopes. Here is how ...
user avatar
  • 331
7 votes

AngularJS - REST + Authentication service

I think these are different layers of responsibility. The service.get('api.example.com/products'); is called in the controller to the corresponding view. What I ...
user avatar
  • 181
7 votes

Hangman learning AI

Here are a few general feedbacks: Have a coherent code style You're mixing multiple code styles sometimes you put spaces around operators ng-show='step == 0', ...
user avatar
  • 171
6 votes

AngularJS constants depending on other constants - any established patterns?

Using an IIFE seems to be the tidiest way I've found to do it. This allows you to define your constant as a function (that is immediately invoked) that returns your constant object so you can use it ...
user avatar
  • 161
6 votes

Improvements to an Angular ScrollSpy module

Nice work! I presume the complicated way of getting the right element measurements is to cater for many browsers, won't comment on that. I would add some comments on the nature of the 'magic number' ...
user avatar
6 votes
Accepted

Filter an array of objects by an array in AngularJS

welcome to CodeReview :-) Firstly, I would mention that your $item and $model parameters should just be ...
user avatar
  • 3,753
6 votes
Accepted

Timer stop watch in AngularJS

Aside from the issue of setIntervals resolution/accuracy there's a lot of room for improvement in your angular. ...
user avatar
  • 16.6k
6 votes
Accepted

FizzBuzzLizardSpock

Very nice. I can't really see any major issues here, just some nits to pick. Note, though, that my knowledge of Angular is near-nil, so perhaps there's something there that someone else will be better ...
user avatar
  • 32.9k
6 votes
Accepted

Function to split full name into first & last

First of all, you should be aware that "first name" and "last name" are very tricky concepts. An example in that linked Wikipedia article is José Luis Rodríguez Zapatero. José Luis is the first name, ...
user avatar
  • 32.9k
6 votes

Baseball player statistics controller

Bearing in mind that you claim that you do not to maintain this code anymore1, there are a few suggestions I would have about this code: define functions and accept parameters- that should allow the ...
user avatar
5 votes

AngularJS Todo List - too much controller logic?

Some remarks and refinements of previous answer but too long to put in the comments. Instead of <button ng-click="addToList()">Add to List</button> ...
user avatar
5 votes
Accepted

Handling errors of nested promises

If I understand correctly, you can unnest your code, and catch any possible error at the end. That's the idea of using promises: ...
user avatar
  • 2,525
5 votes

MVC and Services

Angular is not exactly a MVC framework, it's a MVW - Model-View-Whatever. You can find an explanation here. The application has a good structure: Services to retrieve data from server Controller to ...
user avatar
  • 51
5 votes
Accepted

UI selector directives for an AngularJS invoicing module

Anything that makes each instance of a directive different should be delegated somewhere higher up. You make a "wrapper" directive. Generic logic stays down the hierarchy, while specific logic wraps ...
user avatar
  • 24.8k
5 votes
Accepted

Merging two arrays of objects with different keys/properties

When you merge two arrays, where the one array contains a key value, you can save a lot of time by indexing the keys. Consider an index on the array2 ...
user avatar
  • 96.7k
5 votes
Accepted

Handling rejected HTTP responses with status 401

I'd actually go a bit further than janos. He is perfectly right in that by repeatedly checking rejection.status, you're ...
user avatar
5 votes
Accepted

Summarize JS Array more efficiently

I am also using MomentJS for formatting dates. I have experienced performance issues when using MomentJS before. It's not because it's terrible but rather the opposite. It just does a lot of things ...
user avatar
  • 24.8k
4 votes

AngularJS Tab Control

From a once over: It seems both <tab name="FirstTab" id="Tab1"> and ...
user avatar
  • 32.5k
4 votes

Handling shared state among a lot of elements in Angular

Your View looks fine (HTML and CSS). However, representing the state of your data elements with two string variables that may or may not be storing the "name" field on the parent data object is a very ...
user avatar
  • 695

Only top scored, non community-wiki answers of a minimum length are eligible