Status Function Count

Update status is displayed

HTML

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js"></script>
<script src="https://vitalets.github.io/angular-xeditable/dist/js/xeditable.js"></script>
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="https://vitalets.github.io/angular-xeditable/dist/css/xeditable.css">
<h4>Angular-xeditable Select local (Bootstrap 3)</h4>
<div ng-app="app" ng-controller="Ctrl">
  <a href="#" editable-select="user.value" e-ng-options="s.value as s.text for s in statuses" onaftersave="showStatus('status')" id="status">
    {{::showStatus() }}
  </a>
  <br/><br/>
  <p>
  Change Dropdown Values and Check no. of times showStatus function is called with <b style="color:red;">Count</b> button
  </p>
  <br/>
  <input type="button" class="btn btn-danger" ng-click="count()" value="Show Count"/>
</div>

CSS

div[ng-app] { margin: 50px; }

JavaScript

var app = angular.module("app", ["xeditable"]);

app.run(function(editableOptions) {
  editableOptions.theme = 'bs3';
});

app.controller('Ctrl', function($scope, $filter) {
  $scope.user = {
    value: 2
  }; 

  $scope.statuses = [
    {value: 1, text: 'status1'},
    {value: 2, text: 'status2'},
    {value: 3, text: 'status3'},
    {value: 4, text: 'status4'}
  ]; 
var count =0;
  $scope.showStatus = function(elementId) {
  count = count +1;
    var selected = $filter('filter')($scope.statuses, {value: $scope.user.value});
    var text = ($scope.user.value && selected.length) ? selected[0].text : 'Not set';
    
    if (elementId) {
    	angular.element(document.querySelector("#" + elementId)).text(text);
    } else {
        return text;
    }
  };
  $scope.count = function() {
            alert(count);
        }
        
});