This is a migrated thread and some comments may be shown as answers.

NumericTextBox disappears with ng-switch

1 Answer 87 Views
NumericTextBox
This is a migrated thread and some comments may be shown as answers.
Jakob
Top achievements
Rank 1
Jakob asked on 15 Jan 2016, 05:27 PM

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

1 Answer, 1 is accepted

Sort by
0
Accepted
Petyo
Telerik team
answered on 19 Jan 2016, 01:35 PM
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!
 
Tags
NumericTextBox
Asked by
Jakob
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Share this question
or