Angular refactor

Refactored code to use AngularJS.
same, use a copy