Angular: filter example 1

http://angularjs.org/

HTML

<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
<div ng-controller="MyCtrl">
    today is {{date | date:'dd/MMyyyy'}}
    <br>
    price is {{number | currency}}

        <br> <input type="button" value="Addition" ng-click="ajouter(1)" /> <input type="button" value="Soustraction" ng-click="soustraire(1)"> <input type="button" value="Count Item" ng-click="compter()"><input type="button"  value="Réinitialiser" ng-click="initTab()" />
    
    
        <p>{{nombre}}</p>
        
</div>

JavaScript

var myApp = angular.module('myApp',[]);

function MyCtrl($scope) {
    $scope.tab=[];
    $scope.date = new Date();
    $scope.number = 12.24;
    $scope.nombre=1;
    $scope.ajouter=function(n){
        var number=$scope.nombre;
   //     if(number==3)$scope.nombre=0 ;
        $scope.tab.push($scope.nombre);
        $scope.nombre+=n;
        
   }
   
    $scope.soustraire=function(n){
    
        var myNumber=$scope.nombre;
        
        if($scope.nombre<0) $scope.nombre=0;
        $scope.nombre-=n;
     
        
    
    }
    
    
    $scope.compter=function (){
    
            alert($scope.tab.length);
    }
    
   
    $scope.initTab=function (){
    
            $scope.tab=[];
            alert($scope.tab.length);
    
    }
}