AngularJS: DropdownList dissapears with k-rebind in directive

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

    Posted 02 Apr 2015 Link to this post


    when I use DropdownList inside a directive with the option k-rebind, the Dropdownlist dissapears from DOM when i update the variable used for k-rebind.

    This Dojo shows it:

    What can i do to archieve the update?

    Thanks !

    When dojo ist not available:

    <div ng-app="app" ng-controller="MyCtrl">
       <part-fields indexedreferenceoptions="indexedReferenceOptions"></part-fields>
      var app =angular.module("app", [ "kendo.directives" ]);
      app.controller("MyCtrl", function($scope, $http) {
        $scope.indexedReferenceOptions = {
          dataSource: [],
          dataTextField: "text",
          dataValueField: "value"
        $scope.dataRecord = "";
         $http({ method: "GET", url: "customers.json" })
            $scope.indexedReferenceOptions = {
              dataSource: [
                {"column1":5,"column2":"Frau Schmidt","column3":"z.Hd. Frau Schmidt"},            
                {"column1":6,"column2":"Herr Arber","column3":"z.Hd. Herr Arber"},
                {"column1":7,"column2":"Herr Meier","column3":"z.Hd. Herr Meier"}
              dataTextField: "column2",
          dataValueField: "column1"
           $scope.dataRecord= 5;
      app.directive('partFields', function () {
        return {
            restrict: "E",
            replace: true,       
            scope: {            
                indexedReferenceOptions: '=indexedreferenceoptions'
            controller: function ($scope) {
    $scope.products = [{product: "milk", category: "food", price: 0.75}, 
                                   {product: "eggs", category: "food", price: 1.76}];
            template: ' <div class="form-inline"><div class="form-group" ng-show="true" ng-repeat="product in products"><label>{{ product.product }}</label><span ng-switch="product.category"><select class="form-control" ng-switch-when="food" kendo-drop-down-list k-options="indexedReferenceOptions" k-rebind="indexedReferenceOptions" k-value-primitive="true" k-ng-model="dataRecord"></select></span></div></div></div></div>'   
  2. Georgi Krustev
    Georgi Krustev avatar
    3687 posts

    Posted 06 Apr 2015 Link to this post

    Hello Jakob,

    In general, we do not suggest to use widgets in ng-repeat and then update their properties. You can find more details here.

    What I would suggest is to use the k-ng-delay directive that will initialize the widget once the options are set, either in the error or in the success handlers. Check the updated Dojo demo ( for better understanding.

    Georgi Krustev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top