optimized angular code for minification and tested that it works