NumericTextBox disappears with ng-switch

2 posts, 1 answers
  1. Jakob
    Jakob avatar
    17 posts
    Member since:
    Mar 2013

    Posted 15 Jan Link to this post

    Hi,

     

    i use NumericTextbox with ng-switch and try to rebind it when a decimals value changes. But when the k-rebind value changes, it simply disappears.

     

    <div id="example" ng-app="KendoDemos">
        <div class="demo-section k-content" ng-controller="MyCtrl">
            <div class="box-col">
                <h4>Set Value</h4>
                <p>
                  <div ng-repeat="a in list" ng-switch="a">
                    <input ng-switch-when="1" kendo-numeric-text-box k-min="0" k-max="100" k-decimals="decimals" k-format="format" k-rebind="decimals" k-ng-model="value" style="width: 100%;" />
                </p>
          </div>
            </div>
            <div class="box-col">
                <h4>Result</h4>
                Value: {{value}}
            </div>
        </div>
    </div>

    <script>
      angular.module("KendoDemos", [ "kendo.directives" ])
          .controller("MyCtrl", function($scope, $timeout){
              $scope.value = 50;
        
        $scope.list = [1, 2, 3, 4];
        
        $scope.decimals = 0;
        $scope.format = "n0";
              
    $timeout(function(){
                $scope.format = "n3"
                $scope.decimals = 3
              }, 500);
        
          })
    </script>

     

     

    Thanks for your help

    Antje

  2. Answer
    Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 19 Jan Link to this post

    Hi,

    this seems like an oddity of the ng-switch directive. A workaround you may use is to pull the ng-switch-when to a wrapper - like this.

    Regards,
    Petyo
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
Back to Top