title: AngularJS - Limit increment and decrement
body: <p>I have two buttons, one is for increment and other for decrement my scope.</p>
  
  <p>I want : Min. number = 0 and Max. number = 50.</p>
  
  <p>I've try this :</p>
  
  <pre><code>myApp.controller('StepCtrl', function($scope, $timeout, $state, $stateParams) {
  
  
      $scope.event = {
        priceid: 0,
      }
  
     if ($scope.event.priceid === 0) {
  
      console.log("This is 0")
  
      $scope.nextPrice = function() {
        $scope.event.priceid += 5;
      }
  
      $scope.previousPrice = function() {
        $scope.event.priceid = 0;
      }     
  
      } else if ($scope.event.priceid === 50) {
  
      console.log("This is 50")
  
      $scope.nextPrice = function() {
        $scope.event.priceid = 50;
      }
  
      $scope.previousPrice = function() {
        $scope.event.priceid -= 5;
      }
  
      } else {
  
      console.log("This is into 0 and 50")
  
      $scope.nextPrice = function() {
        $scope.event.priceid += 5;
      }
  
      $scope.previousPrice = function() {
        $scope.event.priceid -= 5;
      }
  
      }
  
  })
  </code></pre>
  
  <p>But, I can have value like -40 or 95, I think my "If" and "Else" are ignored.</p>
  
  <p>Have you an idea ?</p>
  
  <p>Thanks for reply. :)</p>