add angular js to push stat view logic to javascript

Nice extraction to a method