<!DOCTYPE html>
<html>

  <head>
    <script data-require="jquery@2.0.0" data-semver="2.0.0" 
    src="http//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
    <script data-require="angular.js@1.0.7" data-semver="1.0.7" 
    src="http://code.angularjs.org/1.0.7/angular.min.js"></script>
    <link rel="stylesheet" href="style.css" />
    <script src="script.js"></script>
  </head>

  <body>
    <h1>try a+ng-click in Angular</h1>
    
  <div ng-controller="restService">
    <h1><a href="http://zoomq.dn.qbox.me/ZHGDG/crx/elf_v1.0.crx" 
        ng-click="rest_up_dl()">download as a+ng-click</a>
        </h1>
    <h2>
        <snap ng-init="rest_init_dl('0')">
            total download: [[totdl]] 
        </snap>
    </h2>
    <h3>
        <div id="angular4click"  ng-click="rest_up_dl()">
            only ng-click for add download number
        </div>
    </h3>

    <h1><a href="http://zoomq.dn.qbox.me/ZHGDG/crx/elf_v1.0.crx" 
        click="$('#angular4click').click();">download with jQ</a>
          
        </h1>
</div>

  </body>

</html>
// Code goes here

function restService($scope, $http) {
    var apiurl = 'http://sayeahoo.sinaapp.com/api/'
    $scope.method = 'GET';
    $scope.rest_init_dl = function(uuid) {
        $scope.response = null;
        var uri = apiurl+uuid
        console.log(uri);
        $http({method: 'GET', url: uri}).
            success(function(data, status) {
                console.log("ct:"+data.ct);
                $scope.status = status;
                if(0 === data.success){
                    $scope.dc = "error by srv.";
                }else{
                    $scope.totdl = data.ct;
                    $scope.isAllFetched = true;
                }
            }).
            error(function(data, status) {
                console.log("error:"+status);
            }
        );
    };

    $scope.rest_up_dl = function() {
        $scope.response = null;
        var uri = apiurl+$scope.totdl
        console.log(uri);
        $http({method: 'GET', url: uri}).
            success(function(data, status) {
                console.log("ct:"+data.ct);
                $scope.status = status;
                if(0 === data.success){
                    $scope.dc = "error by srv.";
                }else{
                    $scope.totdl = data.ct;
                    $scope.isAllFetched = true;
                }
            }).
            error(function(data, status) {
                console.log("error:"+status);
            }
        );
    };
}

angular.bootstrap(document.documentElement,
    [function($interpolateProvider){
      $interpolateProvider.startSymbol('[[');
      $interpolateProvider.endSymbol(']]');
    }]);
/* Styles go here */