Angular refactor

Refactored code to use AngularJS.
why is this a scope variable?