ObservableArray Angularjs Compatibility Problem

2 posts, 1 answers
  1. Matthias
    Matthias avatar
    2 posts
    Member since:
    Oct 2016

    Posted 30 Nov 2016 Link to this post

    Hello,

    I am forced to use AngularJs Version 1.5.8 because of Angular Material compatibility. Kendo is delivered with angular version 1.4.6. 
    When using kendo with AngularJs 1.5.8 I have a compatibility problem with the ObservablyArray and ng-repeat. Everything seems to work well except with an empty array. If the array is empty ng-repeat produces 3 empty rows when applied to a list as in the following code. With the older angular version 1.4.6 which comes with kendo that does not happen. Is it recommended at all to use angular version 1.5.8 with kendo? What can I do if I need both AngularJS and Angular Material in my kendo application and henceforth the latest angular version?

    <body ng-app="myApp" ng-controller="myController">    
      <ul>
        <li ng-repeat="t in testArr">{{t.x}} : {{t.y}}</li>
      </ul>

      <script>
          angular.module('myApp',['kendo.directives']).controller('myController', ($scope)=>{
              $scope.testArr = new kendo.data.ObservableArray([]);
          });
      </script>
    </body>

  2. Answer
    Stefan
    Admin
    Stefan avatar
    1143 posts

    Posted 02 Dec 2016 Link to this post

    Hello Matthias,

    Thank you for the provided example.

    After additional investigation, I noticed that there is a change in the ng-repeat behaviour from version 1.4.8 and if the array is empty it will use the array properties like length, _events and type.

    The Kendo UI team has no control over this behaviour, but I can suggest using the ng-if directive to not show the ul element if the array is empty:

    http://dojo.telerik.com/opaHa 

    Let me know if you need additional information on this matter.

    Regards,
    Stefan
    Telerik by Progress
    Kendo UI is ready for Visual Studio 2017 RC! Learn more.
Back to Top