AngularJS directive to compute statistics values from markup