How create an input box having a + and - button in Ionic

后端 未结 2 702
遥遥无期
遥遥无期 2021-02-09 08:28

How I can create an input box having a + and - button. Clicking upon which user can change the quantity of product selected, like this screen:

2条回答
  •  南旧
    南旧 (楼主)
    2021-02-09 08:30

    As for ionic v.1 at your template you could have something like:

    At your css

        .red:before {
        color: red;
        }
    
        .green:before {
        color: green;
        }
    
        .flex_row {
        display: -webkit-flex;
        display: flex;
        -webkit-flex-direction: row; 
        flex-direction: row;
        }
    

    And in your controller

    $scope.sub = function(i) {
      i.quantity--;
    }
    
    $scope.add = function(i) {
      i.quantity++;
    }
    

提交回复
热议问题