Refactored js into different files.

Separated different parts of angular into separate files.