Clean Up JS Code for AngularJS