you should assign $scope.coun here and not in the function