separate out controller and directives from each other. Create IIFE for all js files to remove global variables. Use angular.module(name,[]) to create the module for application and angular.module(name) to get that module.