Replace == test with .length in controller.js to avoid jshint warning